get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 955605,
    "url": "http://patchwork.ozlabs.org/api/patches/955605/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180809132958.23036-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": "<20180809132958.23036-4-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-08-09T13:29:46",
    "name": "[v3,03/15] ice: Update request resource command to latest specification",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "46f8679caceeb1fd6f448ef297369539150b101a",
    "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/20180809132958.23036-4-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 60078,
            "url": "http://patchwork.ozlabs.org/api/series/60078/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=60078",
            "date": "2018-08-09T13:29:43",
            "name": "Feature updates for ice",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/60078/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/955605/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/955605/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 AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41mTdp3cfnz9s4c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  9 Aug 2018 23:30:22 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id AB3EC87A1F;\n\tThu,  9 Aug 2018 13:30:20 +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 sFAYeJM7poDG; Thu,  9 Aug 2018 13:30:17 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7E2DD87A1E;\n\tThu,  9 Aug 2018 13:30:17 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id BF3601C3F93\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:15 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id BCC52220E2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:15 +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 C8RmrN5p+qLh for <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:13 +0000 (UTC)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby silver.osuosl.org (Postfix) with ESMTPS id CE888240C4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:13 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Aug 2018 06:30:13 -0700",
            "from kyungmin-mobl.amr.corp.intel.com (HELO\n\tavenkata-mobl4.localdomain) ([10.254.101.153])\n\tby fmsmga006.fm.intel.com with ESMTP; 09 Aug 2018 06:30:09 -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,215,1531810800\"; d=\"scan'208\";a=\"253368094\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu,  9 Aug 2018 06:29:46 -0700",
        "Message-Id": "<20180809132958.23036-4-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180809132958.23036-1-anirudh.venkataramanan@intel.com>",
        "References": "<20180809132958.23036-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v3 03/15] ice: Update request resource\n\tcommand to latest specification",
        "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: Dan Nowlin <dan.nowlin@intel.com>\n\nAlign Request Resource Ownership AQ command (0x0008) to the latest\nspecification. This includes:\n\n- Correcting the resource IDs for the Global Cfg and Change locks.\n- new enum ICE_CHANGE_LOCK_RES_ID\n- new enum ICE_GLOBAL_CFG_LOCK_RES_ID\n- Altering the flow for Global Config Lock to allow only the first PF to\n  download the package.\n\nSigned-off-by: Dan Nowlin <dan.nowlin@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_common.c | 75 ++++++++++++++++-----\n drivers/net/ethernet/intel/ice/ice_common.h |  2 +-\n drivers/net/ethernet/intel/ice/ice_nvm.c    |  2 +-\n drivers/net/ethernet/intel/ice/ice_type.h   |  9 ++-\n 4 files changed, 67 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex 182f96108f22..caf2620b7852 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -967,7 +967,22 @@ enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading)\n  * @timeout: the maximum time in ms that the driver may hold the resource\n  * @cd: pointer to command details structure or NULL\n  *\n- * requests common resource using the admin queue commands (0x0008)\n+ * Requests common resource using the admin queue commands (0x0008).\n+ * When attempting to acquire the Global Config Lock, the driver can\n+ * learn of three states:\n+ *  1) ICE_SUCCESS -        acquired lock, and can perform download package\n+ *  2) ICE_ERR_AQ_ERROR -   did not get lock, driver should fail to load\n+ *  3) ICE_ERR_AQ_NO_WORK - did not get lock, but another driver has\n+ *                          successfully downloaded the package; the driver does\n+ *                          not have to download the package and can continue\n+ *                          loading\n+ *\n+ * Note that if the caller is in an acquire lock, perform action, release lock\n+ * phase of operation, it is possible that the FW may detect a timeout and issue\n+ * a CORER. In this case, the driver will receive a CORER interrupt and will\n+ * have to determine its cause. The calling thread that is handling this flow\n+ * will likely get an error propagated back to it indicating the Download\n+ * Package, Update Package or the Release Resource AQ commands timed out.\n  */\n static enum ice_status\n ice_aq_req_res(struct ice_hw *hw, enum ice_aq_res_ids res,\n@@ -985,13 +1000,43 @@ ice_aq_req_res(struct ice_hw *hw, enum ice_aq_res_ids res,\n \tcmd_resp->res_id = cpu_to_le16(res);\n \tcmd_resp->access_type = cpu_to_le16(access);\n \tcmd_resp->res_number = cpu_to_le32(sdp_number);\n+\tcmd_resp->timeout = cpu_to_le32(*timeout);\n+\t*timeout = 0;\n \n \tstatus = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);\n+\n \t/* The completion specifies the maximum time in ms that the driver\n \t * may hold the resource in the Timeout field.\n-\t * If the resource is held by someone else, the command completes with\n-\t * busy return value and the timeout field indicates the maximum time\n-\t * the current owner of the resource has to free it.\n+\t */\n+\n+\t/* Global config lock response utilizes an additional status field.\n+\t *\n+\t * If the Global config lock resource is held by some other driver, the\n+\t * command completes with ICE_AQ_RES_GLBL_IN_PROG in the status field\n+\t * and the timeout field indicates the maximum time the current owner\n+\t * of the resource has to free it.\n+\t */\n+\tif (res == ICE_GLOBAL_CFG_LOCK_RES_ID) {\n+\t\tif (le16_to_cpu(cmd_resp->status) == ICE_AQ_RES_GLBL_SUCCESS) {\n+\t\t\t*timeout = le32_to_cpu(cmd_resp->timeout);\n+\t\t\treturn 0;\n+\t\t} else if (le16_to_cpu(cmd_resp->status) ==\n+\t\t\t   ICE_AQ_RES_GLBL_IN_PROG) {\n+\t\t\t*timeout = le32_to_cpu(cmd_resp->timeout);\n+\t\t\treturn ICE_ERR_AQ_ERROR;\n+\t\t} else if (le16_to_cpu(cmd_resp->status) ==\n+\t\t\t   ICE_AQ_RES_GLBL_DONE) {\n+\t\t\treturn ICE_ERR_AQ_NO_WORK;\n+\t\t}\n+\n+\t\t/* invalid FW response, force a timeout immediately */\n+\t\t*timeout = 0;\n+\t\treturn ICE_ERR_AQ_ERROR;\n+\t}\n+\n+\t/* If the resource is held by some other driver, the command completes\n+\t * with a busy return value and the timeout field indicates the maximum\n+\t * time the current owner of the resource has to free it.\n \t */\n \tif (!status || hw->adminq.sq_last_status == ICE_AQ_RC_EBUSY)\n \t\t*timeout = le32_to_cpu(cmd_resp->timeout);\n@@ -1030,30 +1075,28 @@ ice_aq_release_res(struct ice_hw *hw, enum ice_aq_res_ids res, u8 sdp_number,\n  * @hw: pointer to the HW structure\n  * @res: resource id\n  * @access: access type (read or write)\n+ * @timeout: timeout in milliseconds\n  *\n  * This function will attempt to acquire the ownership of a resource.\n  */\n enum ice_status\n ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,\n-\t\tenum ice_aq_res_access_type access)\n+\t\tenum ice_aq_res_access_type access, u32 timeout)\n {\n #define ICE_RES_POLLING_DELAY_MS\t10\n \tu32 delay = ICE_RES_POLLING_DELAY_MS;\n+\tu32 time_left = timeout;\n \tenum ice_status status;\n-\tu32 time_left = 0;\n-\tu32 timeout;\n \n \tstatus = ice_aq_req_res(hw, res, access, 0, &time_left, NULL);\n \n-\t/* An admin queue return code of ICE_AQ_RC_EEXIST means that another\n-\t * driver has previously acquired the resource and performed any\n-\t * necessary updates; in this case the caller does not obtain the\n-\t * resource and has no further work to do.\n+\t/* A return code of ICE_ERR_AQ_NO_WORK means that another driver has\n+\t * previously acquired the resource and performed any necessary updates;\n+\t * in this case the caller does not obtain the resource and has no\n+\t * further work to do.\n \t */\n-\tif (hw->adminq.sq_last_status == ICE_AQ_RC_EEXIST) {\n-\t\tstatus = ICE_ERR_AQ_NO_WORK;\n+\tif (status == ICE_ERR_AQ_NO_WORK)\n \t\tgoto ice_acquire_res_exit;\n-\t}\n \n \tif (status)\n \t\tice_debug(hw, ICE_DBG_RES,\n@@ -1066,11 +1109,9 @@ ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,\n \t\ttimeout = (timeout > delay) ? timeout - delay : 0;\n \t\tstatus = ice_aq_req_res(hw, res, access, 0, &time_left, NULL);\n \n-\t\tif (hw->adminq.sq_last_status == ICE_AQ_RC_EEXIST) {\n+\t\tif (status == ICE_ERR_AQ_NO_WORK)\n \t\t\t/* lock free, but no work to do */\n-\t\t\tstatus = ICE_ERR_AQ_NO_WORK;\n \t\t\tbreak;\n-\t\t}\n \n \t\tif (!status)\n \t\t\t/* lock acquired */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h\nindex 9a5519130af1..6455b6952ec8 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.h\n+++ b/drivers/net/ethernet/intel/ice/ice_common.h\n@@ -23,7 +23,7 @@ enum ice_status\n ice_get_link_status(struct ice_port_info *pi, bool *link_up);\n enum ice_status\n ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,\n-\t\tenum ice_aq_res_access_type access);\n+\t\tenum ice_aq_res_access_type access, u32 timeout);\n void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res);\n enum ice_status ice_init_nvm(struct ice_hw *hw);\n enum ice_status\ndiff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c\nindex 295a8cd87fc1..3274c543283c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_nvm.c\n+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c\n@@ -137,7 +137,7 @@ ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)\n \tif (hw->nvm.blank_nvm_mode)\n \t\treturn 0;\n \n-\treturn ice_acquire_res(hw, ICE_NVM_RES_ID, access);\n+\treturn ice_acquire_res(hw, ICE_NVM_RES_ID, access, ICE_NVM_TIMEOUT);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex df953f5f219b..e1a0d0e5d074 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -34,10 +34,15 @@ static inline bool ice_is_tc_ena(u8 bitmap, u8 tc)\n enum ice_aq_res_ids {\n \tICE_NVM_RES_ID = 1,\n \tICE_SPD_RES_ID,\n-\tICE_GLOBAL_CFG_LOCK_RES_ID,\n-\tICE_CHANGE_LOCK_RES_ID\n+\tICE_CHANGE_LOCK_RES_ID,\n+\tICE_GLOBAL_CFG_LOCK_RES_ID\n };\n \n+/* FW update timeout definitions are in milliseconds */\n+#define ICE_NVM_TIMEOUT\t\t\t180000\n+#define ICE_CHANGE_LOCK_TIMEOUT\t\t1000\n+#define ICE_GLOBAL_CFG_LOCK_TIMEOUT\t3000\n+\n enum ice_aq_res_access_type {\n \tICE_RES_READ = 1,\n \tICE_RES_WRITE\n",
    "prefixes": [
        "v3",
        "03/15"
    ]
}