get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1032841,
    "url": "http://patchwork.ozlabs.org/api/patches/1032841/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-3-mika.westerberg@linux.intel.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": "<20190129150143.12681-3-mika.westerberg@linux.intel.com>",
    "list_archive_url": null,
    "date": "2019-01-29T15:01:17",
    "name": "[02/28] thunderbolt: Do not allocate switch if depth is greater than 6",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "e30fe2c8cd8d3e6caa3373e07fd9025229c2eb40",
    "submitter": {
        "id": 14534,
        "url": "http://patchwork.ozlabs.org/api/people/14534/?format=api",
        "name": "Mika Westerberg",
        "email": "mika.westerberg@linux.intel.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/20190129150143.12681-3-mika.westerberg@linux.intel.com/mbox/",
    "series": [
        {
            "id": 88859,
            "url": "http://patchwork.ozlabs.org/api/series/88859/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=88859",
            "date": "2019-01-29T15:01:18",
            "name": "thunderbolt: Software connection manager improvements",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/88859/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1032841/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1032841/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming-netdev@ozlabs.org",
        "Delivered-To": "patchwork-incoming-netdev@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; dmarc=none (p=none dis=none)\n\theader.from=linux.intel.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 43pqZP5VmBz9sMM\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tWed, 30 Jan 2019 02:06:05 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1728137AbfA2PBu (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tTue, 29 Jan 2019 10:01:50 -0500",
            "from mga04.intel.com ([192.55.52.120]:40215 \"EHLO mga04.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1725811AbfA2PBs (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Jan 2019 10:01:48 -0500",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jan 2019 07:01:48 -0800",
            "from black.fi.intel.com ([10.237.72.28])\n\tby orsmga003.jf.intel.com with ESMTP; 29 Jan 2019 07:01:45 -0800",
            "by black.fi.intel.com (Postfix, from userid 1001)\n\tid 351712E0; Tue, 29 Jan 2019 17:01:44 +0200 (EET)"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,537,1539673200\"; d=\"scan'208\";a=\"122266112\"",
        "From": "Mika Westerberg <mika.westerberg@linux.intel.com>",
        "To": "linux-kernel@vger.kernel.org",
        "Cc": "Michael Jamet <michael.jamet@intel.com>,\n\tYehezkel Bernat <YehezkelShB@gmail.com>,\n\tAndreas Noever <andreas.noever@gmail.com>,\n\tLukas Wunner <lukas@wunner.de>, \"David S . Miller\" <davem@davemloft.net>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tnetdev@vger.kernel.org",
        "Subject": "[PATCH 02/28] thunderbolt: Do not allocate switch if depth is\n\tgreater than 6",
        "Date": "Tue, 29 Jan 2019 18:01:17 +0300",
        "Message-Id": "<20190129150143.12681-3-mika.westerberg@linux.intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>",
        "References": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Maximum depth in Thunderbolt topology is 6 so make sure it is not\npossible to allocate switches that exceed the depth limit.\n\nWhile at it update tb_switch_alloc() to use upper/lower_32_bits()\nfollowing tb_switch_alloc_safe_mode().\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n---\n drivers/thunderbolt/icm.c    |  5 ++---\n drivers/thunderbolt/switch.c | 18 ++++++++++++------\n drivers/thunderbolt/tb.h     |  1 +\n 3 files changed, 15 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c\nindex e3fc920af682..041e7ab0efd3 100644\n--- a/drivers/thunderbolt/icm.c\n+++ b/drivers/thunderbolt/icm.c\n@@ -42,7 +42,6 @@\n #define ICM_TIMEOUT\t\t\t5000\t/* ms */\n #define ICM_APPROVE_TIMEOUT\t\t10000\t/* ms */\n #define ICM_MAX_LINK\t\t\t4\n-#define ICM_MAX_DEPTH\t\t\t6\n \n /**\n  * struct icm - Internal connection manager private data\n@@ -709,7 +708,7 @@ icm_fr_device_disconnected(struct tb *tb, const struct icm_pkg_header *hdr)\n \tdepth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>\n \t\tICM_LINK_INFO_DEPTH_SHIFT;\n \n-\tif (link > ICM_MAX_LINK || depth > ICM_MAX_DEPTH) {\n+\tif (link > ICM_MAX_LINK || depth > TB_SWITCH_MAX_DEPTH) {\n \t\ttb_warn(tb, \"invalid topology %u.%u, ignoring\\n\", link, depth);\n \t\treturn;\n \t}\n@@ -739,7 +738,7 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr)\n \tdepth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>\n \t\tICM_LINK_INFO_DEPTH_SHIFT;\n \n-\tif (link > ICM_MAX_LINK || depth > ICM_MAX_DEPTH) {\n+\tif (link > ICM_MAX_LINK || depth > TB_SWITCH_MAX_DEPTH) {\n \t\ttb_warn(tb, \"invalid topology %u.%u, ignoring\\n\", link, depth);\n \t\treturn;\n \t}\ndiff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c\nindex cd96994dc094..a90d21abed88 100644\n--- a/drivers/thunderbolt/switch.c\n+++ b/drivers/thunderbolt/switch.c\n@@ -1155,10 +1155,16 @@ static int tb_switch_get_generation(struct tb_switch *sw)\n struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,\n \t\t\t\t  u64 route)\n {\n-\tint i;\n-\tint cap;\n \tstruct tb_switch *sw;\n-\tint upstream_port = tb_cfg_get_upstream_port(tb->ctl, route);\n+\tint upstream_port;\n+\tint i, cap, depth;\n+\n+\t/* Make sure we do not exceed maximum topology limit */\n+\tdepth = tb_route_length(route);\n+\tif (depth > TB_SWITCH_MAX_DEPTH)\n+\t\treturn NULL;\n+\n+\tupstream_port = tb_cfg_get_upstream_port(tb->ctl, route);\n \tif (upstream_port < 0)\n \t\treturn NULL;\n \n@@ -1175,9 +1181,9 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,\n \n \t/* configure switch */\n \tsw->config.upstream_port_number = upstream_port;\n-\tsw->config.depth = tb_route_length(route);\n-\tsw->config.route_lo = route;\n-\tsw->config.route_hi = route >> 32;\n+\tsw->config.depth = depth;\n+\tsw->config.route_hi = upper_32_bits(route);\n+\tsw->config.route_lo = lower_32_bits(route);\n \tsw->config.enabled = 0;\n \n \t/* initialize ports */\ndiff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h\nindex 52584c4003e3..5faec5a8eb98 100644\n--- a/drivers/thunderbolt/tb.h\n+++ b/drivers/thunderbolt/tb.h\n@@ -43,6 +43,7 @@ struct tb_switch_nvm {\n };\n \n #define TB_SWITCH_KEY_SIZE\t\t32\n+#define TB_SWITCH_MAX_DEPTH\t\t6\n \n /**\n  * struct tb_switch - a thunderbolt switch\n",
    "prefixes": [
        "02/28"
    ]
}