get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 951917,
    "url": "http://patchwork.ozlabs.org/api/patches/951917/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180801040433.5865-12-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": "<20180801040433.5865-12-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-08-01T04:04:31",
    "name": "[v2,11/13] ice: Enable firmware logging during device initialization.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e40c2be0250f9ccd735d27d3f379077778f2a82e",
    "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/20180801040433.5865-12-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 58674,
            "url": "http://patchwork.ozlabs.org/api/series/58674/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=58674",
            "date": "2018-08-01T04:04:20",
            "name": "Feature updates for ice",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/58674/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/951917/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/951917/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 AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41gKTB321Tz9rxx\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  1 Aug 2018 14:05:02 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id D1C0825C00;\n\tWed,  1 Aug 2018 04:05:00 +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 LML+yo2j-9Ki; Wed,  1 Aug 2018 04:04:59 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 484B525BF8;\n\tWed,  1 Aug 2018 04:04:59 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 237A91C0BBC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  1 Aug 2018 04:04:56 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 212D925C00\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  1 Aug 2018 04:04:56 +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 RkFz5Mr5BPEX for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  1 Aug 2018 04:04:55 +0000 (UTC)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 34B4E25636\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  1 Aug 2018 04:04:55 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t31 Jul 2018 21:04:54 -0700",
            "from lnahar-mobl.amr.corp.intel.com (HELO\n\tavenkata-mobl4.localdomain) ([10.252.134.1])\n\tby FMSMGA003.fm.intel.com with ESMTP; 31 Jul 2018 21:04:53 -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.51,430,1526367600\"; d=\"scan'208\";a=\"69105127\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 31 Jul 2018 21:04:31 -0700",
        "Message-Id": "<20180801040433.5865-12-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180801040433.5865-1-anirudh.venkataramanan@intel.com>",
        "References": "<20180801040433.5865-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v2 11/13] ice: Enable firmware logging\n\tduring device initialization.",
        "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": "From: Hieu Tran <hieu.t.tran@intel.com>\n\nTo enable FW logging, the \"cq_en\" and \"uart_en\" enable bits of the\n\"fw_log\" element in struct ice_hw need to set accordingly based on\nsome user-provided parameters during driver loading. To select which\nFW log events to be emitted, the \"cfg\" elements of corresponding FW\nmodules in the \"evnts\" array member of \"fw_log\" need to be configured.\n\nSigned-off-by: Hieu Tran <hieu.t.tran@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]\n---\n .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  83 ++++++++\n drivers/net/ethernet/intel/ice/ice_common.c   | 180 ++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_common.h   |   1 +\n drivers/net/ethernet/intel/ice/ice_main.c     |   3 +\n drivers/net/ethernet/intel/ice/ice_type.h     |  19 ++\n 5 files changed, 286 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\nindex ce3405f870d8..8fb54c3e7bf2 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n@@ -1207,6 +1207,84 @@ struct ice_aqc_dis_txq {\n \tstruct ice_aqc_dis_txq_item qgrps[1];\n };\n \n+/* Configure Firmware Logging Command (indirect 0xFF09)\n+ * Logging Information Read Response (indirect 0xFF10)\n+ * Note: The 0xFF10 command has no input parameters.\n+ */\n+struct ice_aqc_fw_logging {\n+\tu8 log_ctrl;\n+#define ICE_AQC_FW_LOG_AQ_EN\t\tBIT(0)\n+#define ICE_AQC_FW_LOG_UART_EN\t\tBIT(1)\n+\tu8 rsvd0;\n+\tu8 log_ctrl_valid; /* Not used by 0xFF10 Response */\n+#define ICE_AQC_FW_LOG_AQ_VALID\t\tBIT(0)\n+#define ICE_AQC_FW_LOG_UART_VALID\tBIT(1)\n+\tu8 rsvd1[5];\n+\t__le32 addr_high;\n+\t__le32 addr_low;\n+};\n+\n+enum ice_aqc_fw_logging_mod {\n+\tICE_AQC_FW_LOG_ID_GENERAL = 0,\n+\tICE_AQC_FW_LOG_ID_CTRL,\n+\tICE_AQC_FW_LOG_ID_LINK,\n+\tICE_AQC_FW_LOG_ID_LINK_TOPO,\n+\tICE_AQC_FW_LOG_ID_DNL,\n+\tICE_AQC_FW_LOG_ID_I2C,\n+\tICE_AQC_FW_LOG_ID_SDP,\n+\tICE_AQC_FW_LOG_ID_MDIO,\n+\tICE_AQC_FW_LOG_ID_ADMINQ,\n+\tICE_AQC_FW_LOG_ID_HDMA,\n+\tICE_AQC_FW_LOG_ID_LLDP,\n+\tICE_AQC_FW_LOG_ID_DCBX,\n+\tICE_AQC_FW_LOG_ID_DCB,\n+\tICE_AQC_FW_LOG_ID_NETPROXY,\n+\tICE_AQC_FW_LOG_ID_NVM,\n+\tICE_AQC_FW_LOG_ID_AUTH,\n+\tICE_AQC_FW_LOG_ID_VPD,\n+\tICE_AQC_FW_LOG_ID_IOSF,\n+\tICE_AQC_FW_LOG_ID_PARSER,\n+\tICE_AQC_FW_LOG_ID_SW,\n+\tICE_AQC_FW_LOG_ID_SCHEDULER,\n+\tICE_AQC_FW_LOG_ID_TXQ,\n+\tICE_AQC_FW_LOG_ID_RSVD,\n+\tICE_AQC_FW_LOG_ID_POST,\n+\tICE_AQC_FW_LOG_ID_WATCHDOG,\n+\tICE_AQC_FW_LOG_ID_TASK_DISPATCH,\n+\tICE_AQC_FW_LOG_ID_MNG,\n+\tICE_AQC_FW_LOG_ID_MAX,\n+};\n+\n+/* This is the buffer for both of the logging commands.\n+ * The entry array size depends on the datalen parameter in the descriptor.\n+ * There will be a total of datalen / 2 entries.\n+ */\n+struct ice_aqc_fw_logging_data {\n+\t__le16 entry[1];\n+#define ICE_AQC_FW_LOG_ID_S\t\t0\n+#define ICE_AQC_FW_LOG_ID_M\t\t(0xFFF << ICE_AQC_FW_LOG_ID_S)\n+\n+#define ICE_AQC_FW_LOG_CONF_SUCCESS\t0\t/* Used by response */\n+#define ICE_AQC_FW_LOG_CONF_BAD_INDX\tBIT(12)\t/* Used by response */\n+\n+#define ICE_AQC_FW_LOG_EN_S\t\t12\n+#define ICE_AQC_FW_LOG_EN_M\t\t(0xF << ICE_AQC_FW_LOG_EN_S)\n+#define ICE_AQC_FW_LOG_INFO_EN\t\tBIT(12)\t/* Used by command */\n+#define ICE_AQC_FW_LOG_INIT_EN\t\tBIT(13)\t/* Used by command */\n+#define ICE_AQC_FW_LOG_FLOW_EN\t\tBIT(14)\t/* Used by command */\n+#define ICE_AQC_FW_LOG_ERR_EN\t\tBIT(15)\t/* Used by command */\n+};\n+\n+/* Get/Clear FW Log (indirect 0xFF11) */\n+struct ice_aqc_get_clear_fw_log {\n+\tu8 flags;\n+#define ICE_AQC_FW_LOG_CLEAR\t\tBIT(0)\n+#define ICE_AQC_FW_LOG_MORE_DATA_AVAIL\tBIT(1)\n+\tu8 rsvd1[7];\n+\t__le32 addr_high;\n+\t__le32 addr_low;\n+};\n+\n /**\n  * struct ice_aq_desc - Admin Queue (AQ) descriptor\n  * @flags: ICE_AQ_FLAG_* flags\n@@ -1257,6 +1335,8 @@ struct ice_aq_desc {\n \t\tstruct ice_aqc_dis_txqs dis_txqs;\n \t\tstruct ice_aqc_add_get_update_free_vsi vsi_cmd;\n \t\tstruct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;\n+\t\tstruct ice_aqc_fw_logging fw_logging;\n+\t\tstruct ice_aqc_get_clear_fw_log get_clear_fw_log;\n \t\tstruct ice_aqc_alloc_free_res_cmd sw_res_ctrl;\n \t\tstruct ice_aqc_set_event_mask set_event_mask;\n \t\tstruct ice_aqc_get_link_status get_link_status;\n@@ -1354,6 +1434,9 @@ enum ice_adminq_opc {\n \t/* TX queue handling commands/events */\n \tice_aqc_opc_add_txqs\t\t\t\t= 0x0C30,\n \tice_aqc_opc_dis_txqs\t\t\t\t= 0x0C31,\n+\n+\t/* debug commands */\n+\tice_aqc_opc_fw_logging\t\t\t\t= 0xFF09,\n };\n \n #endif /* _ICE_ADMINQ_CMD_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex ad7f450ddf85..9aa394681f93 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -369,6 +369,177 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)\n \tdevm_kfree(ice_hw_to_dev(hw), sw);\n }\n \n+#define ICE_FW_LOG_DESC_SIZE(n)\t(sizeof(struct ice_aqc_fw_logging_data) + \\\n+\t(((n) - 1) * sizeof(((struct ice_aqc_fw_logging_data *)0)->entry)))\n+#define ICE_FW_LOG_DESC_SIZE_MAX\t\\\n+\tICE_FW_LOG_DESC_SIZE(ICE_AQC_FW_LOG_ID_MAX)\n+\n+/**\n+ * ice_cfg_fw_log - configure FW logging\n+ * @hw: pointer to the hw struct\n+ * @enable: enable certain FW logging events if true, disable all if false\n+ *\n+ * This function enables/disables the FW logging via Rx CQ events and a UART\n+ * port based on predetermined configurations. FW logging via the Rx CQ can be\n+ * enabled/disabled for individual PF's. However, FW logging via the UART can\n+ * only be enabled/disabled for all PFs on the same device.\n+ *\n+ * To enable overall FW logging, the \"cq_en\" and \"uart_en\" enable bits in\n+ * hw->fw_log need to be set accordingly, e.g. based on user-provided input,\n+ * before initializing the device.\n+ *\n+ * When re/configuring FW logging, callers need to update the \"cfg\" elements of\n+ * the hw->fw_log.evnts array with the desired logging event configurations for\n+ * modules of interest. When disabling FW logging completely, the callers can\n+ * just pass false in the \"enable\" parameter. On completion, the function will\n+ * update the \"cur\" element of the the hw->fw_log.evnts array with the resulting\n+ * logging event configurations of the modules that are being re/configured. FW\n+ * logging modules that are not part of a reconfiguration operation retain their\n+ * previous states.\n+ *\n+ * Before resetting the device, it is recommended that the driver disables FW\n+ * logging before shutting down the control queue. When disabling FW logging\n+ * (\"enable\" = false), the latest configurations of FW logging events stored in\n+ * hw->fw_log.evnts[] are not overridden to allow them to be reconfigured after\n+ * a device reset.\n+ *\n+ * When enabling FW logging to emit log messages via the Rx CQ during the\n+ * device's initialization phase, a mechanism alternative to interrupt handlers\n+ * needs to be used to extract FW log messages from the Rx CQ periodically and\n+ * to prevent the Rx CQ from being full and stalling other types of control\n+ * messages from FW to SW. Interrupts are typically disabled during the device's\n+ * initialization phase.\n+ */\n+\n+static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable)\n+{\n+\tstruct ice_aqc_fw_logging_data *data = NULL;\n+\tstruct ice_aqc_fw_logging *cmd;\n+\tenum ice_status status = 0;\n+\tu16 i, chgs = 0, len = 0;\n+\tstruct ice_aq_desc desc;\n+\tu8 actv_evnts = 0;\n+\tvoid *buf = NULL;\n+\n+\tif (!hw->fw_log.cq_en && !hw->fw_log.uart_en)\n+\t\treturn 0;\n+\n+\t/* Disable FW logging only when the control queue is still responsive */\n+\tif (!enable &&\n+\t    (!hw->fw_log.actv_evnts || !ice_check_sq_alive(hw, &hw->adminq)))\n+\t\treturn 0;\n+\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging);\n+\tcmd = &desc.params.fw_logging;\n+\n+\t/* Indicate which controls are valid */\n+\tif (hw->fw_log.cq_en)\n+\t\tcmd->log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID;\n+\n+\tif (hw->fw_log.uart_en)\n+\t\tcmd->log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID;\n+\n+\tif (enable) {\n+\t\t/* Fill in an array of entries with FW logging modules and\n+\t\t * logging events being reconfigured.\n+\t\t */\n+\t\tfor (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) {\n+\t\t\tu16 val;\n+\n+\t\t\t/* Keep track of enabled event types */\n+\t\t\tactv_evnts |= hw->fw_log.evnts[i].cfg;\n+\n+\t\t\tif (hw->fw_log.evnts[i].cfg == hw->fw_log.evnts[i].cur)\n+\t\t\t\tcontinue;\n+\n+\t\t\tif (!data) {\n+\t\t\t\tdata = devm_kzalloc(ice_hw_to_dev(hw),\n+\t\t\t\t\t\t    ICE_FW_LOG_DESC_SIZE_MAX,\n+\t\t\t\t\t\t    GFP_KERNEL);\n+\t\t\t\tif (!data)\n+\t\t\t\t\treturn ICE_ERR_NO_MEMORY;\n+\t\t\t}\n+\n+\t\t\tval = i << ICE_AQC_FW_LOG_ID_S;\n+\t\t\tval |= hw->fw_log.evnts[i].cfg << ICE_AQC_FW_LOG_EN_S;\n+\t\t\tdata->entry[chgs++] = cpu_to_le16(val);\n+\t\t}\n+\n+\t\t/* Only enable FW logging if at least one module is specified.\n+\t\t * If FW logging is currently enabled but all modules are not\n+\t\t * enabled to emit log messages, disable FW logging altogether.\n+\t\t */\n+\t\tif (actv_evnts) {\n+\t\t\t/* Leave if there is effectively no change */\n+\t\t\tif (!chgs)\n+\t\t\t\tgoto out;\n+\n+\t\t\tif (hw->fw_log.cq_en)\n+\t\t\t\tcmd->log_ctrl |= ICE_AQC_FW_LOG_AQ_EN;\n+\n+\t\t\tif (hw->fw_log.uart_en)\n+\t\t\t\tcmd->log_ctrl |= ICE_AQC_FW_LOG_UART_EN;\n+\n+\t\t\tbuf = data;\n+\t\t\tlen = ICE_FW_LOG_DESC_SIZE(chgs);\n+\t\t\tdesc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);\n+\t\t}\n+\t}\n+\n+\tstatus = ice_aq_send_cmd(hw, &desc, buf, len, NULL);\n+\tif (!status) {\n+\t\t/* Update the current configuration to reflect events enabled.\n+\t\t * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW\n+\t\t * logging mode is enabled for the device. They do not reflect\n+\t\t * actual modules being enabled to emit log messages. So, their\n+\t\t * values remain unchanged even when all modules are disabled.\n+\t\t */\n+\t\tu16 cnt = enable ? chgs : (u16)ICE_AQC_FW_LOG_ID_MAX;\n+\n+\t\thw->fw_log.actv_evnts = actv_evnts;\n+\t\tfor (i = 0; i < cnt; i++) {\n+\t\t\tu16 v, m;\n+\n+\t\t\tif (!enable) {\n+\t\t\t\t/* When disabling all FW logging events as part\n+\t\t\t\t * of device's de-initialization, the original\n+\t\t\t\t * configurations are retained, and can be used\n+\t\t\t\t * to reconfigure FW logging later if the device\n+\t\t\t\t * is re-initialized.\n+\t\t\t\t */\n+\t\t\t\thw->fw_log.evnts[i].cur = 0;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tv = le16_to_cpu(data->entry[i]);\n+\t\t\tm = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S;\n+\t\t\thw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg;\n+\t\t}\n+\t}\n+\n+out:\n+\tif (data)\n+\t\tdevm_kfree(ice_hw_to_dev(hw), data);\n+\n+\treturn status;\n+}\n+\n+/**\n+ * ice_output_fw_log\n+ * @hw: pointer to the hw struct\n+ * @desc: pointer to the AQ message descriptor\n+ * @buf: pointer to the buffer accompanying the AQ message\n+ *\n+ * Formats a FW Log message and outputs it via the standard driver logs.\n+ */\n+void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf)\n+{\n+\tice_debug(hw, ICE_DBG_AQ_MSG, \"[ FW Log Msg Start ]\\n\");\n+\tice_debug_array(hw, ICE_DBG_AQ_MSG, 16, 1, (u8 *)buf,\n+\t\t\tle16_to_cpu(desc->datalen));\n+\tice_debug(hw, ICE_DBG_AQ_MSG, \"[ FW Log Msg End ]\\n\");\n+}\n+\n /**\n  * ice_init_hw - main hardware initialization routine\n  * @hw: pointer to the hardware structure\n@@ -403,6 +574,11 @@ enum ice_status ice_init_hw(struct ice_hw *hw)\n \tif (status)\n \t\tgoto err_unroll_cqinit;\n \n+\t/* Enable FW logging. Not fatal if this fails. */\n+\tstatus = ice_cfg_fw_log(hw, true);\n+\tif (status)\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to enable FW logging.\\n\");\n+\n \tstatus = ice_clear_pf_cfg(hw);\n \tif (status)\n \t\tgoto err_unroll_cqinit;\n@@ -509,6 +685,10 @@ enum ice_status ice_init_hw(struct ice_hw *hw)\n void ice_deinit_hw(struct ice_hw *hw)\n {\n \tice_sched_cleanup_all(hw);\n+\n+\t/* Attempt to disable FW logging before shutting down control queues */\n+\tice_cfg_fw_log(hw, false);\n+\n \tice_shutdown_all_ctrlq(hw);\n \n \tif (hw->port_info) {\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h\nindex 34c468138a8a..8e56bbbeda56 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.h\n+++ b/drivers/net/ethernet/intel/ice/ice_common.h\n@@ -95,4 +95,5 @@ enum ice_status\n ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps,\n \t\tstruct ice_aqc_add_tx_qgrp *buf, u16 buf_size,\n \t\tstruct ice_sq_cd *cd);\n+void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);\n #endif /* _ICE_COMMON_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 6b2bcd3c1d6e..292d9ca20898 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -984,6 +984,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)\n \t\t\t\tdev_err(&pf->pdev->dev,\n \t\t\t\t\t\"Could not handle link event\");\n \t\t\tbreak;\n+\t\tcase ice_aqc_opc_fw_logging:\n+\t\t\tice_output_fw_log(hw, &event.desc, event.msg_buf);\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\tdev_dbg(&pf->pdev->dev,\n \t\t\t\t\"%s Receive Queue unknown event 0x%04x ignored\\n\",\ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex 75457afc912c..9f57306daf85 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -253,6 +253,24 @@ struct ice_switch_info {\n \tstruct ice_sw_recipe *recp_list;\n };\n \n+/* FW logging configuration */\n+struct ice_fw_log_evnt {\n+\tu8 cfg : 4;\t/* New event enables to configure */\n+\tu8 cur : 4;\t/* Current/active event enables */\n+};\n+\n+struct ice_fw_log_cfg {\n+\tu8 cq_en : 1;    /* FW logging is enabled via the control queue */\n+\tu8 uart_en : 1;  /* FW logging is enabled via UART for all PFs */\n+\tu8 actv_evnts;   /* Cumulation of currently enabled log events */\n+\n+#define ICE_FW_LOG_EVNT_INFO\t(ICE_AQC_FW_LOG_INFO_EN >> ICE_AQC_FW_LOG_EN_S)\n+#define ICE_FW_LOG_EVNT_INIT\t(ICE_AQC_FW_LOG_INIT_EN >> ICE_AQC_FW_LOG_EN_S)\n+#define ICE_FW_LOG_EVNT_FLOW\t(ICE_AQC_FW_LOG_FLOW_EN >> ICE_AQC_FW_LOG_EN_S)\n+#define ICE_FW_LOG_EVNT_ERR\t(ICE_AQC_FW_LOG_ERR_EN >> ICE_AQC_FW_LOG_EN_S)\n+\tstruct ice_fw_log_evnt evnts[ICE_AQC_FW_LOG_ID_MAX];\n+};\n+\n /* Port hardware description */\n struct ice_hw {\n \tu8 __iomem *hw_addr;\n@@ -301,6 +319,7 @@ struct ice_hw {\n \tu8 fw_patch;\t\t/* firmware patch version */\n \tu32 fw_build;\t\t/* firmware build number */\n \n+\tstruct ice_fw_log_cfg fw_log;\n \t/* minimum allowed value for different speeds */\n #define ICE_ITR_GRAN_MIN_200\t1\n #define ICE_ITR_GRAN_MIN_100\t1\n",
    "prefixes": [
        "v2",
        "11/13"
    ]
}