On Mon, Feb 11, 2019 at 10:45:58AM +0200, Mika Westerberg wrote: > On Sun, Feb 10, 2019 at 04:33:28PM +0100, Lukas Wunner wrote: > > 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 > > > Are you sure Apple actually uses setup like that? I think I have never > seen such configuration happening on any of the devices I have.
Sorry, I don't know if they actually use that. > I can update the changelog to mention that if you think it is useful. > Something like below maybe? > > PCIe actually does not need this as it is typically a daisy chain > between two adjacent switches but this way we do not need to hard-code > creation of the tunnel. LGTM, thanks. > > > + 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? > > Yes, I think you are right. Simply subtracting the depths of the start and end port's switch also yields the path length. Of course this assumes that tunnels aren't established between non-adjacent switches, but your algorithm doesn't do that. Thanks, Lukas