{"id":814983,"url":"http://patchwork.ozlabs.org/api/patches/814983/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170918153049.44185-6-mika.westerberg@linux.intel.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","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":"<20170918153049.44185-6-mika.westerberg@linux.intel.com>","list_archive_url":null,"date":"2017-09-18T15:30:38","name":"[05/16] thunderbolt: Move tb_switch_phy_port_from_link() to thunderbolt.h","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":true,"hash":"623956073ce44f0de4d596a28a4891a37fa44cfa","submitter":{"id":14534,"url":"http://patchwork.ozlabs.org/api/people/14534/?format=json","name":"Mika Westerberg","email":"mika.westerberg@linux.intel.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170918153049.44185-6-mika.westerberg@linux.intel.com/mbox/","series":[{"id":3664,"url":"http://patchwork.ozlabs.org/api/series/3664/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=3664","date":"2017-09-18T15:30:47","name":"Thunderbolt networking","version":1,"mbox":"http://patchwork.ozlabs.org/series/3664/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814983/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814983/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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xwqpC1jcKz9s78\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 01:35:31 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755011AbdIRPbA (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 11:31:00 -0400","from mga01.intel.com ([192.55.52.88]:40495 \"EHLO mga01.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1754675AbdIRPa6 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 18 Sep 2017 11:30:58 -0400","from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t18 Sep 2017 08:30:57 -0700","from black.fi.intel.com ([10.237.72.28])\n\tby fmsmga002.fm.intel.com with ESMTP; 18 Sep 2017 08:30:54 -0700","by black.fi.intel.com (Postfix, from userid 1001)\n\tid 97AF1352; Mon, 18 Sep 2017 18:30:49 +0300 (EEST)"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,413,1500966000\"; d=\"scan'208\";a=\"1220359528\"","From":"Mika Westerberg <mika.westerberg@linux.intel.com>","To":"Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\t\"David S . Miller\" <davem@davemloft.net>","Cc":"Andreas Noever <andreas.noever@gmail.com>,\n\tMichael Jamet <michael.jamet@intel.com>,\n\tYehezkel Bernat <yehezkel.bernat@intel.com>,\n\tAmir Levy <amir.jer.levy@intel.com>,\n\tMario.Limonciello@dell.com, Lukas Wunner <lukas@wunner.de>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tlinux-kernel@vger.kernel.org, netdev@vger.kernel.org","Subject":"[PATCH 05/16] thunderbolt: Move tb_switch_phy_port_from_link() to\n\tthunderbolt.h","Date":"Mon, 18 Sep 2017 18:30:38 +0300","Message-Id":"<20170918153049.44185-6-mika.westerberg@linux.intel.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170918153049.44185-1-mika.westerberg@linux.intel.com>","References":"<20170918153049.44185-1-mika.westerberg@linux.intel.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"A Thunderbolt service might need to find the physical port from a link\nthe cable is connected to. For instance networking driver uses this\ninformation to generate MAC address according the Apple ThunderboltIP\nprotocol.\n\nMove this function to thunderbolt.h and rename it to\ntb_phy_port_from_link() to reflect the fact that it does not take switch\nas parameter.\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\nReviewed-by: Michael Jamet <michael.jamet@intel.com>\nReviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>\n---\n drivers/thunderbolt/icm.c   | 2 +-\n drivers/thunderbolt/tb.h    | 7 -------\n include/linux/thunderbolt.h | 7 +++++++\n 3 files changed, 8 insertions(+), 8 deletions(-)","diff":"diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c\nindex 53250fc057e1..8c22b91ed040 100644\n--- a/drivers/thunderbolt/icm.c\n+++ b/drivers/thunderbolt/icm.c\n@@ -89,7 +89,7 @@ static inline struct tb *icm_to_tb(struct icm *icm)\n \n static inline u8 phy_port_from_route(u64 route, u8 depth)\n {\n-\treturn tb_switch_phy_port_from_link(route >> ((depth - 1) * 8));\n+\treturn tb_phy_port_from_link(route >> ((depth - 1) * 8));\n }\n \n static inline u8 dual_link_from_link(u8 link)\ndiff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h\nindex 2fefe76621ca..ea21d927bd09 100644\n--- a/drivers/thunderbolt/tb.h\n+++ b/drivers/thunderbolt/tb.h\n@@ -40,8 +40,6 @@ struct tb_switch_nvm {\n };\n \n #define TB_SWITCH_KEY_SIZE\t\t32\n-/* Each physical port contains 2 links on modern controllers */\n-#define TB_SWITCH_LINKS_PER_PHY_PORT\t2\n \n /**\n  * struct tb_switch - a thunderbolt switch\n@@ -367,11 +365,6 @@ struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link,\n \t\t\t\t\t       u8 depth);\n struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid);\n \n-static inline unsigned int tb_switch_phy_port_from_link(unsigned int link)\n-{\n-\treturn (link - 1) / TB_SWITCH_LINKS_PER_PHY_PORT;\n-}\n-\n static inline void tb_switch_put(struct tb_switch *sw)\n {\n \tput_device(&sw->dev);\ndiff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h\nindex 89dbb0c20f07..4011d6537a8c 100644\n--- a/include/linux/thunderbolt.h\n+++ b/include/linux/thunderbolt.h\n@@ -78,6 +78,13 @@ struct tb {\n \n extern struct bus_type tb_bus_type;\n \n+#define TB_LINKS_PER_PHY_PORT\t2\n+\n+static inline unsigned int tb_phy_port_from_link(unsigned int link)\n+{\n+\treturn (link - 1) / TB_LINKS_PER_PHY_PORT;\n+}\n+\n /**\n  * struct tb_property_dir - XDomain property directory\n  * @uuid: Directory UUID or %NULL if root directory\n","prefixes":["05/16"]}