{"id":818181,"url":"http://patchwork.ozlabs.org/api/patches/818181/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170925110738.68382-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":"<20170925110738.68382-6-mika.westerberg@linux.intel.com>","list_archive_url":null,"date":"2017-09-25T11:07:27","name":"[v2,05/16] thunderbolt: Move tb_switch_phy_port_from_link() to thunderbolt.h","commit_ref":null,"pull_url":null,"state":"changes-requested","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/20170925110738.68382-6-mika.westerberg@linux.intel.com/mbox/","series":[{"id":4937,"url":"http://patchwork.ozlabs.org/api/series/4937/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4937","date":"2017-09-25T11:07:27","name":"Thunderbolt networking","version":2,"mbox":"http://patchwork.ozlabs.org/series/4937/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818181/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818181/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 3y11X91LPNz9tXC\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 21:07:53 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S934935AbdIYLHv (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 25 Sep 2017 07:07:51 -0400","from mga04.intel.com ([192.55.52.120]:56732 \"EHLO mga04.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S934897AbdIYLHr (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 25 Sep 2017 07:07:47 -0400","from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Sep 2017 04:07:46 -0700","from black.fi.intel.com ([10.237.72.28])\n\tby orsmga002.jf.intel.com with ESMTP; 25 Sep 2017 04:07:43 -0700","by black.fi.intel.com (Postfix, from userid 1001)\n\tid 91796384; Mon, 25 Sep 2017 14:07:38 +0300 (EEST)"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,435,1500966000\"; d=\"scan'208\";a=\"139089123\"","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\tAndrew Lunn <andrew@lunn.ch>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tlinux-kernel@vger.kernel.org, netdev@vger.kernel.org","Subject":"[PATCH v2 05/16] thunderbolt: Move tb_switch_phy_port_from_link()\n\tto thunderbolt.h","Date":"Mon, 25 Sep 2017 14:07:27 +0300","Message-Id":"<20170925110738.68382-6-mika.westerberg@linux.intel.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170925110738.68382-1-mika.westerberg@linux.intel.com>","References":"<20170925110738.68382-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 910b1bf92112..43b8d1e09341 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":["v2","05/16"]}