On Sun, Feb 10, 2019 at 04:33:28PM +0100, Lukas Wunner wrote:
> 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?

Interesting.

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.

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.

> > +   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.

> > +   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?

No, I'll add NULL check there.

Reply via email to