Re: New NTB API Issue

From: Logan Gunthorpe
Date: Thu Jun 22 2017 - 18:19:38 EST

On 6/22/2017 4:12 PM, Allen Hubbe wrote:
The resource size given by peer_mw_get_addr might be different than the max_size given by ntb_mw_get_align.

I am most familiar with the ntb_hw_intel driver and that type of ntb hardware. The peer_mw_get_addr size is of the primary bar on the side to be the source of the translated writes (or reads). In b2b topology, at least, the first translation of that write lands it on the secondary bar of the peer ntb. That size of that bar could different than the first. The second translation lands the write in memory (eg). So, the end-to-end translation is limited by the first AND second sizes.

The first point is, the *max_size returned by intel_ntb_mw_get_align looks wrong. That should be the size of the secondary bar, not the resource size of the primary bar, of that device.

The second point is, because the sizes returned by peer_mw_get_addr, and ntb_mw_get_align, may be different, the two sides should communicate and reconcile the address and size information when setting up the translations.

Ok, that makes some sense. So drivers that don't need this should return -1 or something like that? Though, I'd still suggest that until a driver actually needs this, and it's implemented correctly in the clients, we should leave it out.

Any thoughts on changing the semantics of mw_get_align so it must be called with the link up?