get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54589,
    "url": "http://patches.dpdk.org/api/patches/54589/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1560152324-20538-13-git-send-email-arybchenko@solarflare.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": "<1560152324-20538-13-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1560152324-20538-13-git-send-email-arybchenko@solarflare.com",
    "date": "2019-06-10T07:38:27",
    "name": "[12/29] net/sfc/base: support direct FW update for bundle partitions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3eb219b30071d8d15a8c878b2d0d6fbc4299a740",
    "submitter": {
        "id": 607,
        "url": "http://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1560152324-20538-13-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [
        {
            "id": 4965,
            "url": "http://patches.dpdk.org/api/series/4965/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4965",
            "date": "2019-06-10T07:38:19",
            "name": "net/sfc/base: update base driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4965/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54589/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54589/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CCB541BEB9;\n\tMon, 10 Jun 2019 09:39:07 +0200 (CEST)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n\t[67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 2F0C61BE8C\n\tfor <dev@dpdk.org>; Mon, 10 Jun 2019 09:38:55 +0200 (CEST)",
            "from webmail.solarflare.com (webmail.solarflare.com\n\t[12.187.104.26])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n\t3765F4C005D\n\tfor <dev@dpdk.org>; Mon, 10 Jun 2019 07:38:54 +0000 (UTC)",
            "from ocex03.SolarFlarecom.com (10.20.40.36) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id 15.0.1395.4; Mon, 10 Jun 2019 00:38:51 -0700",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1395.4 via Frontend Transport; Mon, 10 Jun 2019 00:38:50 -0700",
            "from ukv-loginhost.uk.solarflarecom.com\n\t(ukv-loginhost.uk.solarflarecom.com [10.17.10.39])\n\tby opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tx5A7cn77008792; Mon, 10 Jun 2019 08:38:49 +0100",
            "from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])\n\tby ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id\n\t87C511616E0; Mon, 10 Jun 2019 08:38:49 +0100 (BST)"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Richard Houldsworth <rhouldsworth@solarflare.com>",
        "Date": "Mon, 10 Jun 2019 08:38:27 +0100",
        "Message-ID": "<1560152324-20538-13-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1560152324-20538-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1560152324-20538-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-TM-AS-Product-Ver": "SMEX-12.5.0.1300-8.5.1010-24664.003",
        "X-TM-AS-Result": "No-3.914700-4.000000-10",
        "X-TMASE-MatchedRID": "m5OjDIbmcT9tJ5HtYGckb4QHGus7Cfv1mGheEvjzATvBSouFRjh0Aq2L\n\tobuNU2ek0pjhOiE8kTdTvVffeIwvQ8HVNeDWrWSGXrumkbea2Mk/pOSL72dTfwdkFovAReUoilv\n\tAb18i4hNWkAzeYr3deqkshZJNRaqN56XkomU2m5VIcJTn2HkqsfngX/aL8PCNCkKOpUQuXBWvpK\n\t1251ntyLedRuu+nkCTGKpaxRNmG5ibII6cSoXys0NuJSeNFwKYqV3VmuIFNEs+0zQnFXpU+nYM2\n\tAZgEFG98Hvdz7S04K6AMSNP1w8cRYZmskxZzd/WngIgpj8eDcAZ1CdBJOsoY8RB0bsfrpPInxMy\n\teYT53Rl4mjaLB+Or6U44QID+nYPcFuyP6ZrfLxx4cvcfu1iizU4a5qeeI6ziKHMssfVxXG5Gpob\n\t1v3OnWzjTSL5EeglIVePgUA+TiUGTdSRXlCnjBIjjlF305EnAWUm8SESyzd+8353hqEyjk1Zca9\n\tRSYo/b",
        "X-TM-AS-User-Approved-Sender": "No",
        "X-TM-AS-User-Blocked-Sender": "No",
        "X-TMASE-Result": "10--3.914700-4.000000",
        "X-TMASE-Version": "SMEX-12.5.0.1300-8.5.1010-24664.003",
        "X-MDID": "1560152334-q0fl3c4JsAfw",
        "Subject": "[dpdk-dev] [PATCH 12/29] net/sfc/base: support direct FW update for\n\tbundle partitions",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Richard Houldsworth <rhouldsworth@solarflare.com>\n\nAll signed images other than for the MCFW partition should\nbe written fully to the partition with no rearrangement.\n\nSigned-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n drivers/net/sfc/base/ef10_image.c | 74 ++++++++++++++++++++++++---------------\n drivers/net/sfc/base/efx.h        |  1 +\n 2 files changed, 47 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/drivers/net/sfc/base/ef10_image.c b/drivers/net/sfc/base/ef10_image.c\nindex c035e0d..a19df7f 100644\n--- a/drivers/net/sfc/base/ef10_image.c\n+++ b/drivers/net/sfc/base/ef10_image.c\n@@ -7,6 +7,8 @@\n #include \"efx.h\"\n #include \"efx_impl.h\"\n \n+#include \"ef10_firmware_ids.h\"\n+\n #if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2\n \n #if EFSYS_OPT_IMAGE_LAYOUT\n@@ -429,54 +431,59 @@\n \n static\t__checkReturn\tefx_rc_t\n efx_check_unsigned_image(\n-\t__in\t\tvoid\t\t*bufferp,\n-\t__in\t\tuint32_t\tbuffer_size)\n+\t__in\t\tvoid\t\t\t*bufferp,\n+\t__in\t\tuint32_t\t\tbuffer_size,\n+\t__out\t\tefx_image_header_t\t**headerpp,\n+\t__out\t\tefx_image_trailer_t\t**trailerpp)\n {\n-\tefx_image_header_t *header;\n-\tefx_image_trailer_t *trailer;\n+\tefx_image_header_t *headerp;\n+\tefx_image_trailer_t *trailerp;\n \tuint32_t crc;\n \tefx_rc_t rc;\n \n-\tEFX_STATIC_ASSERT(sizeof (*header) == EFX_IMAGE_HEADER_SIZE);\n-\tEFX_STATIC_ASSERT(sizeof (*trailer) == EFX_IMAGE_TRAILER_SIZE);\n+\tEFX_STATIC_ASSERT(sizeof (*headerp) == EFX_IMAGE_HEADER_SIZE);\n+\tEFX_STATIC_ASSERT(sizeof (*trailerp) == EFX_IMAGE_TRAILER_SIZE);\n \n \t/* Must have at least enough space for required image header fields */\n \tif (buffer_size < (EFX_FIELD_OFFSET(efx_image_header_t, eih_size) +\n-\t\tsizeof (header->eih_size))) {\n+\t\tsizeof (headerp->eih_size))) {\n \t\trc = ENOSPC;\n \t\tgoto fail1;\n \t}\n-\theader = (efx_image_header_t *)bufferp;\n+\theaderp = (efx_image_header_t *)bufferp;\n \n-\tif (header->eih_magic != EFX_IMAGE_HEADER_MAGIC) {\n-\t\trc = EINVAL;\n+\t/* Buffer must have space for image header, code and image trailer. */\n+\tif (buffer_size < (headerp->eih_size + headerp->eih_code_size +\n+\t\tEFX_IMAGE_TRAILER_SIZE)) {\n+\t\trc = ENOSPC;\n \t\tgoto fail2;\n \t}\n \n+\ttrailerp = (efx_image_trailer_t *)((uint8_t *)headerp +\n+\t    headerp->eih_size + headerp->eih_code_size);\n+\n+\t*headerpp = headerp;\n+\t*trailerpp = trailerp;\n+\n+\tif (headerp->eih_magic != EFX_IMAGE_HEADER_MAGIC) {\n+\t\trc = EINVAL;\n+\t\tgoto fail3;\n+\t}\n+\n \t/*\n \t * Check image header version is same or higher than lowest required\n \t * version.\n \t */\n-\tif (header->eih_version < EFX_IMAGE_HEADER_VERSION) {\n+\tif (headerp->eih_version < EFX_IMAGE_HEADER_VERSION) {\n \t\trc = EINVAL;\n-\t\tgoto fail3;\n-\t}\n-\n-\t/* Buffer must have space for image header, code and image trailer. */\n-\tif (buffer_size < (header->eih_size + header->eih_code_size +\n-\t\tEFX_IMAGE_TRAILER_SIZE)) {\n-\t\trc = ENOSPC;\n \t\tgoto fail4;\n \t}\n \n \t/* Check CRC from image buffer matches computed CRC. */\n-\ttrailer = (efx_image_trailer_t *)((uint8_t *)header +\n-\t    header->eih_size + header->eih_code_size);\n+\tcrc = efx_crc32_calculate(0, (uint8_t *)headerp,\n+\t    (headerp->eih_size + headerp->eih_code_size));\n \n-\tcrc = efx_crc32_calculate(0, (uint8_t *)header,\n-\t    (header->eih_size + header->eih_code_size));\n-\n-\tif (trailer->eit_crc != crc) {\n+\tif (trailerp->eit_crc != crc) {\n \t\trc = EINVAL;\n \t\tgoto fail5;\n \t}\n@@ -507,9 +514,10 @@\n \tuint32_t image_offset;\n \tuint32_t image_size;\n \tvoid *imagep;\n+\tefx_image_header_t *headerp;\n+\tefx_image_trailer_t *trailerp;\n \tefx_rc_t rc;\n \n-\n \tEFSYS_ASSERT(infop != NULL);\n \tif (infop == NULL) {\n \t\trc = EINVAL;\n@@ -531,7 +539,7 @@\n \tif (rc == 0) {\n \t\t/*\n \t\t * Buffer holds signed image format. Check that the encapsulated\n-\t\t * content is in unsigned image format.\n+\t\t * content contains an unsigned image format header.\n \t\t */\n \t\tformat = EFX_IMAGE_FORMAT_SIGNED;\n \t} else {\n@@ -546,11 +554,21 @@\n \t}\n \timagep = (uint8_t *)bufferp + image_offset;\n \n-\t/* Check unsigned image layout (image header, code, image trailer) */\n-\trc = efx_check_unsigned_image(imagep, image_size);\n+\t/* Check image layout (image header, code, image trailer) */\n+\trc = efx_check_unsigned_image(imagep, image_size, &headerp, &trailerp);\n \tif (rc != 0)\n \t\tgoto fail4;\n \n+\t/*\n+\t * Signed images are packages consumed directly by the firmware,\n+\t * with the exception of MC firmware, where the image must be\n+\t * rearranged for booting purposes.\n+\t */\n+\tif (format == EFX_IMAGE_FORMAT_SIGNED) {\n+\t\tif (headerp->eih_type != FIRMWARE_TYPE_MCFW)\n+\t\t\tformat = EFX_IMAGE_FORMAT_SIGNED_PACKAGE;\n+\t}\n+\n \t/* Return image details */\n \tinfop->eii_format = format;\n \tinfop->eii_imagep = bufferp;\ndiff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h\nindex 4905918..d46e650 100644\n--- a/drivers/net/sfc/base/efx.h\n+++ b/drivers/net/sfc/base/efx.h\n@@ -1889,6 +1889,7 @@ enum {\n \tEFX_IMAGE_FORMAT_INVALID,\n \tEFX_IMAGE_FORMAT_UNSIGNED,\n \tEFX_IMAGE_FORMAT_SIGNED,\n+\tEFX_IMAGE_FORMAT_SIGNED_PACKAGE\n } efx_image_format_t;\n \n typedef struct efx_image_info_s {\n",
    "prefixes": [
        "12/29"
    ]
}