Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1032825/?format=api
{ "id": 1032825, "url": "http://patchwork.ozlabs.org/api/patches/1032825/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-20-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-20-mika.westerberg@linux.intel.com>", "list_archive_url": null, "date": "2019-01-29T15:01:34", "name": "[19/28] thunderbolt: Generalize port finding routines to support all port types", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "aad7f69c64e6c5d2c2094f32a00a668234ab312a", "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-20-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/1032825/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1032825/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 43pqXC67Xgz9sDP\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tWed, 30 Jan 2019 02:04:11 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1729088AbfA2PEG (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tTue, 29 Jan 2019 10:04:06 -0500", "from mga06.intel.com ([134.134.136.31]:3065 \"EHLO mga06.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1728376AbfA2PBy (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Jan 2019 10:01:54 -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:54 -0800", "from black.fi.intel.com ([10.237.72.28])\n\tby orsmga007.jf.intel.com with ESMTP; 29 Jan 2019 07:01:51 -0800", "by black.fi.intel.com (Postfix, from userid 1001)\n\tid 213D6A4F; Tue, 29 Jan 2019 17:01:45 +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=\"110723799\"", "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 19/28] thunderbolt: Generalize port finding routines to\n\tsupport all port types", "Date": "Tue, 29 Jan 2019 18:01:34 +0300", "Message-Id": "<20190129150143.12681-20-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 will be needing these routines to find Display Port adapters as well\nso modify them to take port type as the second parameter.\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n---\n drivers/thunderbolt/switch.c | 16 ++++++++++++++++\n drivers/thunderbolt/tb.c | 35 +++++++++++++++++------------------\n drivers/thunderbolt/tb.h | 1 +\n 3 files changed, 34 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c\nindex c1bab1bc7150..de69ada9a2f7 100644\n--- a/drivers/thunderbolt/switch.c\n+++ b/drivers/thunderbolt/switch.c\n@@ -743,6 +743,22 @@ struct tb_port *tb_port_get_next(struct tb_port *start, struct tb_port *end,\n \treturn next;\n }\n \n+/**\n+ * tb_port_is_enabled() - Is the adapter port enabled\n+ * @port: Port to check\n+ */\n+bool tb_port_is_enabled(struct tb_port *port)\n+{\n+\tswitch (port->config.type) {\n+\tcase TB_TYPE_PCIE_UP:\n+\tcase TB_TYPE_PCIE_DOWN:\n+\t\treturn tb_pci_port_is_enabled(port);\n+\n+\tdefault:\n+\t\treturn false;\n+\t}\n+}\n+\n /**\n * tb_pci_port_is_enabled() - Is the PCIe adapter port enabled\n * @port: PCIe port to check\ndiff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c\nindex 1dcdf619d0f1..0df1d96e46f5 100644\n--- a/drivers/thunderbolt/tb.c\n+++ b/drivers/thunderbolt/tb.c\n@@ -188,40 +188,39 @@ static void tb_free_unplugged_children(struct tb_switch *sw)\n \t}\n }\n \n-\n /**\n- * find_pci_up_port() - return the first PCIe up port on @sw or NULL\n+ * tb_find_port() - return the first port of @type on @sw or NULL\n+ * @sw: Switch to find the port from\n+ * @type: Port type to look for\n */\n-static struct tb_port *tb_find_pci_up_port(struct tb_switch *sw)\n+static struct tb_port *tb_find_port(struct tb_switch *sw,\n+\t\t\t\t enum tb_port_type type)\n {\n \tint i;\n \tfor (i = 1; i <= sw->config.max_port_number; i++)\n-\t\tif (sw->ports[i].config.type == TB_TYPE_PCIE_UP)\n+\t\tif (sw->ports[i].config.type == type)\n \t\t\treturn &sw->ports[i];\n \treturn NULL;\n }\n \n /**\n- * find_unused_down_port() - return the first inactive PCIe down port on @sw\n+ * tb_find_unused_port() - return the first inactive port on @sw\n+ * @sw: Switch to find the port on\n+ * @type: Port type to look for\n */\n-static struct tb_port *tb_find_unused_down_port(struct tb_switch *sw)\n+static struct tb_port *tb_find_unused_port(struct tb_switch *sw,\n+\t\t\t\t\t enum tb_port_type type)\n {\n \tint i;\n-\tint cap;\n-\tint res;\n-\tint data;\n+\n \tfor (i = 1; i <= sw->config.max_port_number; i++) {\n \t\tif (tb_is_upstream_port(&sw->ports[i]))\n \t\t\tcontinue;\n-\t\tif (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN)\n-\t\t\tcontinue;\n-\t\tcap = sw->ports[i].cap_adap;\n-\t\tif (cap < 0)\n+\t\tif (sw->ports[i].config.type != type)\n \t\t\tcontinue;\n-\t\tres = tb_port_read(&sw->ports[i], &data, TB_CFG_PORT, cap, 1);\n-\t\tif (res < 0)\n+\t\tif (sw->ports[i].cap_adap < 0)\n \t\t\tcontinue;\n-\t\tif (data & 0x80000000)\n+\t\tif (tb_port_is_enabled(&sw->ports[i]))\n \t\t\tcontinue;\n \t\treturn &sw->ports[i];\n \t}\n@@ -235,7 +234,7 @@ static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw)\n \tstruct tb_port *up, *down;\n \tstruct tb_tunnel *tunnel;\n \n-\tup = tb_find_pci_up_port(sw);\n+\tup = tb_find_port(sw, TB_TYPE_PCIE_UP);\n \tif (!up)\n \t\treturn 0;\n \n@@ -246,7 +245,7 @@ static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw)\n \tdown = NULL;\n \tparent_sw = tb_to_switch(sw->dev.parent);\n \twhile (parent_sw) {\n-\t\tdown = tb_find_unused_down_port(parent_sw);\n+\t\tdown = tb_find_unused_port(parent_sw, TB_TYPE_PCIE_DOWN);\n \t\tif (down)\n \t\t\tbreak;\n \t\tparent_sw = tb_to_switch(parent_sw->dev.parent);\ndiff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h\nindex b3a422ab4b4e..bf5bc0fb0f8e 100644\n--- a/drivers/thunderbolt/tb.h\n+++ b/drivers/thunderbolt/tb.h\n@@ -463,6 +463,7 @@ struct tb_port *tb_port_get_next(struct tb_port *start, struct tb_port *end,\n \n int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec);\n int tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap);\n+bool tb_port_is_enabled(struct tb_port *port);\n \n bool tb_pci_port_is_enabled(struct tb_port *port);\n int tb_pci_port_enable(struct tb_port *port, bool enable);\n", "prefixes": [ "19/28" ] }