get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 813493,
    "url": "http://patchwork.ozlabs.org/api/patches/813493/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170913155131.18090-4-jakub.kicinski@netronome.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170913155131.18090-4-jakub.kicinski@netronome.com>",
    "list_archive_url": null,
    "date": "2017-09-13T15:51:31",
    "name": "[net,3/3] nfp: wait for the NSP resource to appear on boot",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "746f159f10307155e509705f1a921494cd0883cc",
    "submitter": {
        "id": 67484,
        "url": "http://patchwork.ozlabs.org/api/people/67484/?format=api",
        "name": "Jakub Kicinski",
        "email": "jakub.kicinski@netronome.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170913155131.18090-4-jakub.kicinski@netronome.com/mbox/",
    "series": [
        {
            "id": 2942,
            "url": "http://patchwork.ozlabs.org/api/series/2942/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=2942",
            "date": "2017-09-13T15:51:28",
            "name": "nfp: wait more carefully for card init",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2942/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813493/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813493/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=netronome-com.20150623.gappssmtp.com\n\theader.i=@netronome-com.20150623.gappssmtp.com\n\theader.b=\"u/zcxNzu\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsmPS37lBz9ryv\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 14 Sep 2017 01:51:56 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751943AbdIMPvz (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 13 Sep 2017 11:51:55 -0400",
            "from mail-pg0-f53.google.com ([74.125.83.53]:45578 \"EHLO\n\tmail-pg0-f53.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751642AbdIMPvq (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 13 Sep 2017 11:51:46 -0400",
            "by mail-pg0-f53.google.com with SMTP id 188so1137239pgb.2\n\tfor <netdev@vger.kernel.org>; Wed, 13 Sep 2017 08:51:46 -0700 (PDT)",
            "from jkicinski-Precision-T1700.netronome.com ([75.53.12.129])\n\tby smtp.gmail.com with ESMTPSA id\n\td69sm5024402pfl.50.2017.09.13.08.51.44\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 13 Sep 2017 08:51:44 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=netronome-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=ahLf5VH4Lp/CRaKnJDEPwMT4qgigOGJXMfB380Qn0vI=;\n\tb=u/zcxNzuQ59QuIJI/cj4ZhDOtVnHZsuaagUlxH4b/lSzT/JLK++Th6Iei2UKtY2aFa\n\tL6CaoFFVrXIrcVYj90PukjnAqDtAyPwPD7mkdMUQVnBsR2UAlq4vnrEwRa6OSeEFUBKh\n\ttIotdvLc0oOiOwaubBSsIlu+0CcZTDl7I6BPWPMK54t9Pkyaer4T3wbqF9xvUfRUTcxi\n\tE/c66AbTg5Crfrk8Qc/TKxRIxy9BfyCZkeNPKab6q9RcQ9Dh3rlxKb7ruIfY/8bkO5mR\n\th/ThRQP3Z+c6coMjFzPjyQr6nHbi5zq2D6V/n7ctHVQJy/ROtqMdKhP71weh92WEPzua\n\tys9g==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ahLf5VH4Lp/CRaKnJDEPwMT4qgigOGJXMfB380Qn0vI=;\n\tb=mfHK5Pr3uhcwOWNiODwB+Jtjs4BS1T9jWC28vkT6QpZZSNm9vWQjAE9Jr8LwoXVKIo\n\twzjfnk42OWGo0s6NLT9Kxw3An0TAbDqEGntr3b4QJzHhigf1DlN+cOgehRnRaRwvkHzf\n\tE1sMoiHclgou7g0TQZxa/CHhGXfVPR9Tmq3A3O5xOgWPabAG0JlGAxHfFCLqEv0jdtHN\n\tHT+oc0+jBE7QBx4C/M4O1Jvqiuf07naa8Pw7Mlrp/Cy0CPy3+I2z+mULDyRxlqVByDAa\n\tLzbEKfSFvWSFVw6TS6henU11QuGBPt+3Q5dtZt3ko8AhIFjJYYxgVlR1gyQzXEOPX16r\n\tfw1w==",
        "X-Gm-Message-State": "AHPjjUhzf0PZLAsus1qHBFV1IQg3bvqu5a1t9vapkUMW9mMA4ZcD8kJR\n\tPseVaOWW02FicM9sTq4=",
        "X-Google-Smtp-Source": "ADKCNb40rNBui4E54I7I947rRsS1bjWMDkFj1uZ9iBWntTXp9P2Bmqv+hHJwufwBFwP0/LpWajpHYg==",
        "X-Received": "by 10.99.65.68 with SMTP id o65mr18381304pga.193.1505317905400; \n\tWed, 13 Sep 2017 08:51:45 -0700 (PDT)",
        "From": "Jakub Kicinski <jakub.kicinski@netronome.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "oss-drivers@netronome.com, Jakub Kicinski <jakub.kicinski@netronome.com>",
        "Subject": "[PATCH net 3/3] nfp: wait for the NSP resource to appear on boot",
        "Date": "Wed, 13 Sep 2017 08:51:31 -0700",
        "Message-Id": "<20170913155131.18090-4-jakub.kicinski@netronome.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170913155131.18090-1-jakub.kicinski@netronome.com>",
        "References": "<20170913155131.18090-1-jakub.kicinski@netronome.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "The control process (NSP) may take some time to complete its\ninitialization.  This is not a problem on most servers, but\non very fast-booting machines it may not be ready for operation\nwhen driver probes the device.  There is also a version of the\nflash in the wild where NSP tries to train the links as part\nof init.  To wait for NSP initialization we should make sure\nits resource has already been added to the resource table.\nNSP adds itself there as last step of init.\n\nSigned-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>\nReviewed-by: Simon Horman <simon.horman@netronome.com>\n---\n drivers/net/ethernet/netronome/nfp/nfp_main.c      |  4 ++\n drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h   |  2 +\n .../ethernet/netronome/nfp/nfpcore/nfp_resource.c  | 45 ++++++++++++++++++++++\n 3 files changed, 51 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c\nindex 424707d41fbd..1c17b261a21c 100644\n--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c\n+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c\n@@ -390,6 +390,10 @@ static void nfp_fw_unload(struct nfp_pf *pf)\n \tstruct nfp_nsp *nsp;\n \tint err;\n \n+\terr = nfp_resource_wait(pf->cpp, NFP_RESOURCE_NSP, 30);\n+\tif (err)\n+\t\treturn err;\n+\n \tnsp = nfp_nsp_open(pf->cpp);\n \tif (IS_ERR(nsp)) {\n \t\tnfp_err(pf->cpp, \"Reset failed, can't open NSP\\n\");\ndiff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h\nindex 1a8d04a1e113..3ce51f03126f 100644\n--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h\n+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h\n@@ -97,6 +97,8 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name);\n \n void nfp_resource_release(struct nfp_resource *res);\n \n+int nfp_resource_wait(struct nfp_cpp *cpp, const char *name, unsigned int secs);\n+\n u32 nfp_resource_cpp_id(struct nfp_resource *res);\n \n const char *nfp_resource_name(struct nfp_resource *res);\ndiff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c\nindex 072612263dab..b1dd13ff282b 100644\n--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c\n+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c\n@@ -249,6 +249,51 @@ void nfp_resource_release(struct nfp_resource *res)\n \tkfree(res);\n }\n \n+/**\n+ * nfp_resource_wait() - Wait for resource to appear\n+ * @cpp:\tNFP CPP handle\n+ * @name:\tName of the resource\n+ * @secs:\tNumber of seconds to wait\n+ *\n+ * Wait for resource to appear in the resource table, grab and release\n+ * its lock.  The wait is jiffies-based, don't expect fine granularity.\n+ *\n+ * Return: 0 on success, errno otherwise.\n+ */\n+int nfp_resource_wait(struct nfp_cpp *cpp, const char *name, unsigned int secs)\n+{\n+\tunsigned long warn_at = jiffies + NFP_MUTEX_WAIT_FIRST_WARN * HZ;\n+\tunsigned long err_at = jiffies + secs * HZ;\n+\tstruct nfp_resource *res;\n+\n+\twhile (true) {\n+\t\tres = nfp_resource_acquire(cpp, name);\n+\t\tif (!IS_ERR(res)) {\n+\t\t\tnfp_resource_release(res);\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\tif (PTR_ERR(res) != -ENOENT) {\n+\t\t\tnfp_err(cpp, \"error waiting for resource %s: %ld\\n\",\n+\t\t\t\tname, PTR_ERR(res));\n+\t\t\treturn PTR_ERR(res);\n+\t\t}\n+\t\tif (time_is_before_eq_jiffies(err_at)) {\n+\t\t\tnfp_err(cpp, \"timeout waiting for resource %s\\n\", name);\n+\t\t\treturn -ETIMEDOUT;\n+\t\t}\n+\t\tif (time_is_before_eq_jiffies(warn_at)) {\n+\t\t\twarn_at = jiffies + NFP_MUTEX_WAIT_NEXT_WARN * HZ;\n+\t\t\tnfp_info(cpp, \"waiting for NFP resource %s\\n\", name);\n+\t\t}\n+\t\tif (msleep_interruptible(10)) {\n+\t\t\tnfp_err(cpp, \"wait for resource %s interrupted\\n\",\n+\t\t\t\tname);\n+\t\t\treturn -ERESTARTSYS;\n+\t\t}\n+\t}\n+}\n+\n /**\n  * nfp_resource_cpp_id() - Return the cpp_id of a resource handle\n  * @res:\tNFP Resource handle\n",
    "prefixes": [
        "net",
        "3/3"
    ]
}