Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1032831/?format=api
{ "id": 1032831, "url": "http://patchwork.ozlabs.org/api/patches/1032831/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-9-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-9-mika.westerberg@linux.intel.com>", "list_archive_url": null, "date": "2019-01-29T15:01:23", "name": "[08/28] thunderbolt: Properly disable path", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "dcaafb3f81307e18569f1c7a04d8e25bfb00a7f7", "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-9-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/1032831/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1032831/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 43pqY60Xt6z9sDL\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tWed, 30 Jan 2019 02:04:58 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1728275AbfA2PBx (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tTue, 29 Jan 2019 10:01:53 -0500", "from mga06.intel.com ([134.134.136.31]:3058 \"EHLO mga06.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1728166AbfA2PBv (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Jan 2019 10:01:51 -0500", "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jan 2019 07:01:50 -0800", "from black.fi.intel.com ([10.237.72.28])\n\tby orsmga007.jf.intel.com with ESMTP; 29 Jan 2019 07:01:48 -0800", "by black.fi.intel.com (Postfix, from userid 1001)\n\tid 8A5AA533; 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=\"110723763\"", "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 08/28] thunderbolt: Properly disable path", "Date": "Tue, 29 Jan 2019 18:01:23 +0300", "Message-Id": "<20190129150143.12681-9-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": "We need to wait until all buffers have been drained before the path can\nbe considered disabled. Do this for every hop in a path. Also if the\nswitch is physically disconnected, do not bother disabling it anymore\n(it is not present anyway).\n\nThis adds another bit field to struct tb_regs_hop even if we are trying\nto get rid of them but we can clean them up another day.\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n---\n drivers/thunderbolt/path.c | 44 ++++++++++++++++++++++++++++++++---\n drivers/thunderbolt/tb_regs.h | 3 ++-\n 2 files changed, 43 insertions(+), 4 deletions(-)", "diff": "diff --git a/drivers/thunderbolt/path.c b/drivers/thunderbolt/path.c\nindex a11956522bac..48cb15ff4446 100644\n--- a/drivers/thunderbolt/path.c\n+++ b/drivers/thunderbolt/path.c\n@@ -7,6 +7,8 @@\n \n #include <linux/slab.h>\n #include <linux/errno.h>\n+#include <linux/delay.h>\n+#include <linux/ktime.h>\n \n #include \"tb.h\"\n \n@@ -74,13 +76,49 @@ static void __tb_path_deallocate_nfc(struct tb_path *path, int first_hop)\n \t}\n }\n \n+static int __tb_path_deactivate_hop(struct tb_port *port, int hop_index)\n+{\n+\tstruct tb_regs_hop hop;\n+\tktime_t timeout;\n+\tint ret;\n+\n+\tif (port->sw->is_unplugged)\n+\t\treturn 0;\n+\n+\t/* Disable the path */\n+\tret = tb_port_read(port, &hop, TB_CFG_HOPS, 2 * hop_index, 2);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\thop.enable = 0;\n+\n+\tret = tb_port_write(port, &hop, TB_CFG_HOPS, 2 * hop_index, 2);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Wait until it is drained */\n+\ttimeout = ktime_add_ms(ktime_get(), 500);\n+\tdo {\n+\t\tret = tb_port_read(port, &hop, TB_CFG_HOPS, 2 * hop_index, 2);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tif (!hop.pending)\n+\t\t\treturn 0;\n+\n+\t\tusleep_range(10, 20);\n+\t} while (ktime_before(ktime_get(), timeout));\n+\n+\treturn -ETIMEDOUT;\n+}\n+\n static void __tb_path_deactivate_hops(struct tb_path *path, int first_hop)\n {\n \tint i, res;\n-\tstruct tb_regs_hop hop = { };\n+\n \tfor (i = first_hop; i < path->path_length; i++) {\n-\t\tres = tb_port_write(path->hops[i].in_port, &hop, TB_CFG_HOPS,\n-\t\t\t\t 2 * path->hops[i].in_hop_index, 2);\n+\t\tres = __tb_path_deactivate_hop(path->hops[i].in_port,\n+\t\t\t\t\t path->hops[i].in_hop_index);\n \t\tif (res)\n \t\t\ttb_port_warn(path->hops[i].in_port,\n \t\t\t\t \"hop deactivation failed for hop %d, index %d\\n\",\ndiff --git a/drivers/thunderbolt/tb_regs.h b/drivers/thunderbolt/tb_regs.h\nindex 1ab6e0fb31c0..82ac4ec8757f 100644\n--- a/drivers/thunderbolt/tb_regs.h\n+++ b/drivers/thunderbolt/tb_regs.h\n@@ -234,7 +234,8 @@ struct tb_regs_hop {\n \tbool egress_fc:1;\n \tbool ingress_shared_buffer:1;\n \tbool egress_shared_buffer:1;\n-\tu32 unknown3:4; /* set to zero */\n+\tbool pending:1;\n+\tu32 unknown3:3; /* set to zero */\n } __packed;\n \n /* Common link controller registers */\n", "prefixes": [ "08/28" ] }