Re: [PATCH v3 19/36] thunderbolt: Extend tunnel creation to more than 2 adjacent switches

Lukas Wunner
2019-04-08T08:53:43Z

On Mon, Apr 08, 2019 at 10:35:17AM +0300, Mika Westerberg wrote:
> On Sun, Apr 07, 2019 at 06:54:25PM +0200, Lukas Wunner wrote:
> > According to the code comment in struct tb_regs_hop (in tb_regs.h),
> > the out_hopid ("next_hop" in struct tb_regs_hop) denotes the
> > "hop to take after sending the packet through out_port (on the
> > incoming port of the next switch)".
> >
> > So intuitively, the hop config space is like a routing table and
> > the entry in in_port's hop config space specifies through which
> > out_port the packets shall be routed, and which entry to look up
> > on the remote port reachable through out_port.
> >
> > This means that the out_hopid must always be identical to the in_hopid
> > of out_port->remote. Otherwise the routing wouldn't work.
> >
> > And yet, you've introduced *two* struct ida for each port in
> > patch 16. This doesn't seem to make sense: The out_hopids ida
> > of a port always has to be identical to the in_hopids ida of that
> > port's remote. But if it's identical, why does it have to exist
> > twice?
>
> The reason for two HopID allocators (struct idas) is to make it possible
> to track HopIDs to each direction. The same port can be output for one
> path and input for another. I'm not sure how that can be done without
> having two struct idas per port.
>
> You are right, in case of out port HopID connecter to remote in port,
> they should use the same HopID.

Hm, what other cases are there, i.e. what is the meaning of a tb_regs_hop's
"next_hop" field if "out_port" doesn't have a remote? (And why does it
need to be tracked on the out_port? In case a remote is added later?)

Thanks,

Lukas