Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1662545imj; Sun, 10 Feb 2019 07:33:53 -0800 (PST) X-Google-Smtp-Source: AHgI3Iby6o/fBXNobG4M6HPqATjiPezbQ1vMcopvzoq6TyyCuo4hu5IgC0NZ9wsFiMwbXn/hjk/s X-Received: by 2002:a62:ca03:: with SMTP id n3mr33256393pfg.241.1549812833269; Sun, 10 Feb 2019 07:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549812833; cv=none; d=google.com; s=arc-20160816; b=oMM6XZA9K7YHNSq/YXhoC13k2r3uLGgeA/dU5SDvuep8HD88u2QkYFlsAEKyKlNw7r Q8I83Byf6qtrGk1KP+YHEpqyhmoVWVD2ez6NbhiYHjh+VEIIGZHtepDvv32XvHtSK0ze FnafxLK8ggXSrGg48DaijJbasPN3+Za6ba1T4vd2Z5tqo5+DQ2sO1yx/ma2Y26MQ0xw6 Z8I92z1MU3lcxQ9TpN7RUxMIvDr1OupSZP4fd6UUkSWtLLmNxozdYUtiaITSxPxXKct+ q8Y8H1B/utG69jt9sAOoKBbYFfUeF55RKUnsBSktiI11cn82VxqDmzDEjkLVuw+zCgVo xlzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OWsOahGjOL5v4rt2EopVqsPDMPlarr4HQJsp/TWLhYU=; b=P+JzvmKCC1o5iy2lq+qhMgGLjSB6HkBxo1/T9kFeVcvgBqOq9ZU6WRooZi1Rh/5qp8 I86wdT5j074AZH5CZMbIdXv5/38r9+LC0vGmOUDzQpl9RiMhx4Db4+O1jCQXv2g/Lkmr 2vkCxdeuXr5eT8UJbeH0I/A5m/5mKcbFa90AsZcEMG087571R1/+YdrvPRo+FIfzPJ3D Qrq22DpNhXl8SJPNKR2GcjjV4F8ESiBBbH3Hh0fvbR+O2QnKUPIzU4juXC5K3+597hL3 McIVkitqLBOasAt9bQTO1chB7wmtFScmzYHyLOOUSUHV+YE7zkiVtAXOr5U6qgxpZLvB lKNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e192si7749789pfc.28.2019.02.10.07.33.34; Sun, 10 Feb 2019 07:33:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbfBJPdb (ORCPT + 99 others); Sun, 10 Feb 2019 10:33:31 -0500 Received: from bmailout1.hostsharing.net ([83.223.95.100]:46585 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfBJPdb (ORCPT ); Sun, 10 Feb 2019 10:33:31 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 48CA730000CC1; Sun, 10 Feb 2019 16:33:29 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 093D6DFE15; Sun, 10 Feb 2019 16:33:28 +0100 (CET) Date: Sun, 10 Feb 2019 16:33:28 +0100 From: Lukas Wunner To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , Andy Shevchenko Subject: Re: [PATCH v2 14/28] thunderbolt: Extend tunnel creation to more than 2 adjacent switches Message-ID: <20190210153328.44ur6o5z2xjae42c@wunner.de> References: <20190206131738.43696-1-mika.westerberg@linux.intel.com> <20190206131738.43696-15-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206131738.43696-15-mika.westerberg@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 04:17:24PM +0300, Mika Westerberg wrote: > Now that we can allocate hop IDs per port on a path, we can take > advantage of this and create tunnels covering longer paths than just > between two adjacent switches. PCIe actually does not need this as it is > always a daisy chain between two adjacent switches but this way we do > not need to hard-code creation of the tunnel. That doesn't seem to be correct, at the bottom of this page there's a figure showing a PCI tunnel between non-adjacent switches (blue line): https://developer.apple.com/library/archive/documentation/HardwareDrivers/Conceptual/ThunderboltDevGuide/Basics/Basics.html I'm not sure if there are advantages to such tunnels: Reduced latency perhaps because packets need not pass through PCIe adapters on the in-between device? Or maybe this allows for more fine-grained traffic prioritization? > + i = 0; > + tb_for_each_port(in_port, src, dst) > + i++; This looks more complicated than necessary. Isn't the path length always the length of the route string from in_port switch to out_port switch, plus 2 for the adapter on each end? Or do paths without adapters exist? > + for (i = 0; i < num_hops; i++) { > + in_port = tb_port_get_next(src, dst, out_port); > + > + if (in_port->dual_link_port && in_port->link_nr != link_nr) > + in_port = in_port->dual_link_port; > + > + ret = tb_port_alloc_in_hopid(in_port, in_hopid, -1); > + if (ret < 0) > + goto err; > + in_hopid = ret; > + > + out_port = tb_port_get_next(src, dst, in_port); > + if (!out_port) > + goto err; There's a NULL pointer check here, but the invocation of tb_port_get_next() further up to assign in_port lacks such a check. Is it guaranteed to never be NULL? Thanks, Lukas