get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127004,
    "url": "http://patches.dpdk.org/api/patches/127004/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230518151638.1207021-11-qiming.yang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230518151638.1207021-11-qiming.yang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230518151638.1207021-11-qiming.yang@intel.com",
    "date": "2023-05-18T15:16:28",
    "name": "[v2,10/20] net/ice/base: reduce time to read Option data",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "58c8fd3293e4731c36b9709b3ffc36b6dc9f07be",
    "submitter": {
        "id": 522,
        "url": "http://patches.dpdk.org/api/people/522/?format=api",
        "name": "Qiming Yang",
        "email": "qiming.yang@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230518151638.1207021-11-qiming.yang@intel.com/mbox/",
    "series": [
        {
            "id": 28063,
            "url": "http://patches.dpdk.org/api/series/28063/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28063",
            "date": "2023-05-18T15:16:18",
            "name": "net/ice/base: code update",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/28063/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/127004/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/127004/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id DA42042AF1;\n\tThu, 18 May 2023 17:35:45 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2C7CD42D73;\n\tThu, 18 May 2023 17:34:37 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id E3ACF42D65\n for <dev@dpdk.org>; Thu, 18 May 2023 17:34:35 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 May 2023 08:34:35 -0700",
            "from dpdk-qiming3.sh.intel.com ([10.67.111.4])\n by fmsmga007.fm.intel.com with ESMTP; 18 May 2023 08:34:34 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1684424076; x=1715960076;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=lb333tuOyBEOQbOnkVopabBBEkYV2Wf9LkCqHnXVZ3E=;\n b=ihuk8J4F6JvsQq0nhckteDMoAADdGF8M/rV7t9i/cCe7k0SO5t06BjcA\n NveVdHrQoaM2QUnF6J0INKtGTpsY05ZokAXWmlPjO2l3C8+u2J4ndzDlK\n 7+EASfB4mnjbW+FPOzSO00UdhfYSi0XeMWOonNNG7SXDbWOAaF5+1Aegy\n ynWCL8lae0o7ObO8FY8qc/2KKYKGbBn+u20FwJlrRhW3o14layTNgy6KZ\n yr2FrISZHrMDDMlRyY9muH98emFC8WjBYadJelcSTjoIheXlC727QXEZ1\n UvoO19hjMG1GrzDyfI+PX0VS3wWqFrMxEfqAUHRbsbDEaoexOrQdw5Nc3 A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10714\"; a=\"341527700\"",
            "E=Sophos;i=\"5.99,285,1677571200\"; d=\"scan'208\";a=\"341527700\"",
            "E=McAfee;i=\"6600,9927,10714\"; a=\"705235127\"",
            "E=Sophos;i=\"5.99,285,1677571200\"; d=\"scan'208\";a=\"705235127\""
        ],
        "X-ExtLoop1": "1",
        "From": "Qiming Yang <qiming.yang@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qi.z.zhang@intel.com, Qiming Yang <qiming.yang@intel.com>,\n Jacob Keller <jacob.e.keller@intel.com>",
        "Subject": "[PATCH v2 10/20] net/ice/base: reduce time to read Option data",
        "Date": "Thu, 18 May 2023 15:16:28 +0000",
        "Message-Id": "<20230518151638.1207021-11-qiming.yang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230518151638.1207021-1-qiming.yang@intel.com>",
        "References": "<20230427062001.478032-1-qiming.yang@intel.com>\n <20230518151638.1207021-1-qiming.yang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Re-write ice_get_orom_civd_data to allocate memory to store the\nOption ROM data. This change significantly reduces the time\nto read the Option ROM CIVD section from ~10 seconds down to ~1 second.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nSigned-off-by: Qiming Yang <qiming.yang@intel.com>\n---\n drivers/net/ice/base/ice_nvm.c | 50 +++++++++++++++++++++++++---------\n 1 file changed, 37 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c\nindex cb45cb8134..e46aded12a 100644\n--- a/drivers/net/ice/base/ice_nvm.c\n+++ b/drivers/net/ice/base/ice_nvm.c\n@@ -724,43 +724,67 @@ static enum ice_status\n ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,\n \t\t       struct ice_orom_civd_info *civd)\n {\n-\tstruct ice_orom_civd_info tmp;\n+\tu8 *orom_data;\n+\tenum ice_status status;\n \tu32 offset;\n \n \t/* The CIVD section is located in the Option ROM aligned to 512 bytes.\n \t * The first 4 bytes must contain the ASCII characters \"$CIV\".\n \t * A simple modulo 256 sum of all of the bytes of the structure must\n \t * equal 0.\n+\t *\n+\t * The exact location is unknown and varies between images but is\n+\t * usually somewhere in the middle of the bank. We need to scan the\n+\t * Option ROM bank to locate it.\n+\t *\n+\t * It's significantly faster to read the entire Option ROM up front\n+\t * using the maximum page size, than to read each possible location\n+\t * with a separate firmware command.\n \t */\n+\torom_data = (u8 *)ice_calloc(hw, hw->flash.banks.orom_size, sizeof(u8));\n+\tif (!orom_data)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\tstatus = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0,\n+\t\t\t\t       orom_data, hw->flash.banks.orom_size);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_NVM, \"Unable to read Option ROM data\\n\");\n+\t\treturn status;\n+\t}\n+\n+\t/* Scan the memory buffer to locate the CIVD data section */\n \tfor (offset = 0; (offset + 512) <= hw->flash.banks.orom_size; offset += 512) {\n-\t\tenum ice_status status;\n+\t\tstruct ice_orom_civd_info *tmp;\n \t\tu8 sum = 0, i;\n \n-\t\tstatus = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR,\n-\t\t\t\t\t       offset, (u8 *)&tmp, sizeof(tmp));\n-\t\tif (status) {\n-\t\t\tice_debug(hw, ICE_DBG_NVM, \"Unable to read Option ROM CIVD data\\n\");\n-\t\t\treturn status;\n-\t\t}\n+\t\ttmp = (struct ice_orom_civd_info *)&orom_data[offset];\n \n \t\t/* Skip forward until we find a matching signature */\n-\t\tif (memcmp(\"$CIV\", tmp.signature, sizeof(tmp.signature)) != 0)\n+\t\tif (memcmp(\"$CIV\", tmp->signature, sizeof(tmp->signature)) != 0)\n \t\t\tcontinue;\n \n+\t\tice_debug(hw, ICE_DBG_NVM, \"Found CIVD section at offset %u\\n\",\n+\t\t\t  offset);\n+\n \t\t/* Verify that the simple checksum is zero */\n-\t\tfor (i = 0; i < sizeof(tmp); i++)\n-\t\t\tsum += ((u8 *)&tmp)[i];\n+\t\tfor (i = 0; i < sizeof(*tmp); i++)\n+\t\t\tsum += ((u8 *)tmp)[i];\n \n \t\tif (sum) {\n \t\t\tice_debug(hw, ICE_DBG_NVM, \"Found CIVD data with invalid checksum of %u\\n\",\n \t\t\t\t  sum);\n-\t\t\treturn ICE_ERR_NVM;\n+\t\t\tgoto err_invalid_checksum;\n \t\t}\n \n-\t\t*civd = tmp;\n+\t\t*civd = *tmp;\n+\t\tice_free(hw, orom_data);\n \t\treturn ICE_SUCCESS;\n \t}\n \n+\tice_debug(hw, ICE_DBG_NVM, \"Unable to locate CIVD data within the Option ROM\\n\");\n+\n+err_invalid_checksum:\n+\tice_free(hw, orom_data);\n \treturn ICE_ERR_NVM;\n }\n \n",
    "prefixes": [
        "v2",
        "10/20"
    ]
}