Re: [PATCH v2 4/8] NTB: ntb_pingpong: Choose doorbells based on port number

From: Allen Hubbe
Date: Tue Jul 24 2018 - 13:26:27 EST


On Mon, Jul 23, 2018 at 12:08 PM Logan Gunthorpe <logang@xxxxxxxxxxxx> wrote:
> I don't think you'll ever have a case where two peers have the same
> index, as the index is really an abstract concept the hardware doesn't
> really know about.

That is the point of index, that there should never be two peers with
the same index, and also that the range of index values is bounded.
Port numbers are problematic, so I'm worried about the change to use
port number in the client drivers instead of using index. For
example, this change assumes that the index value is < bits per long
long, because the value is used in BIT_ULL(port number).

Maybe I'm missing something... In the crosslink case, there is
another doorbell register on the other side of the crosslink. Whether
to use the nearby or via-crosslink doorbell depends on the peer
index... making assumptions about the hw driver, but is that about
right? Then you are selecting bits in the doorbell register based on
port number, ok, that must be how the bits of the shared db register
are associated with ports in your configuration. Maybe what's
actually needed is a ntb_peer_db_valid_mask(peer index), and if only
the port-numbered db bit (or any other combination) is valid for that
peer, so be it, that can be an implementation choice of the hw driver
and below.