Re: [PATCH v1 1/6] PCI/P2PDMA: Rename upstream_bridge_distance() and rework documentation

From: Logan Gunthorpe
Date: Thu Jun 10 2021 - 18:26:19 EST





On 2021-06-10 4:05 p.m., Bjorn Helgaas wrote:
> The new text is:
>
> If there are two virtual functions of the same device behind the same
> bridge port then PCI_P2PDMA_MAP_BUS_ADDR and a distance of 2 will be
> returned (one step down to the PCIe switch, then one step back to the
> same device).
>
> I *think* this includes two functions of the same multi-function
> device, or two virtual functions of the same device, right? In both
> cases, the two devices are obviously behind the same bridge port.

Yes, that's correct, if it's the same device it must be behind the same
bridge port; so dropping the "behind the same bridge port" is a good idea.

>
> Is this usage of "down to the PCIe switch" the common usage in P2PDMA?
> I normally think of going from an endpoint to a switch as being "up"
> toward the CPU. But PCIe made it all confusing by putting downstream
> ports at the upstream end of links and vice versa.

Good point. I've been casually saying "down to", but you are right "up"
makes a lot more sense given the downstream/upstream terminology.

> We also have a bit of a mix in terminology between "bridge," "switch,"
> "bridge port." I'd probably write something like:
>
> If they are two functions of the same device behind the same bridge,
> return PCI_P2PDMA_MAP_BUS_ADDR and a distance of 2 (one hop up to
> the bridge, then one hop back down to another function of the same
> device).
>
> No need to repost for this; just let me know what you think and I can
> tweak accordingly.

What you've written sounds good to me, but I might have just dropped the
"behind the same bridge" entirely given your feedback above.

Thanks!

Logan