OSDN Git Service

NTB: Introduce helper functions to calculate logical port number
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 23 May 2019 22:30:53 +0000 (16:30 -0600)
committerJon Mason <jdmason@kudzu.us>
Thu, 13 Jun 2019 12:59:47 +0000 (08:59 -0400)
commit246a42c51bc5dd247629f86c87d5e1b7628343c4
tree92be49c08271bb83b9f5fc653192dc131b8f8301
parentfcdf8e95fa3b97097bd4e200f0ee04df85b04d99
NTB: Introduce helper functions to calculate logical port number

This patch introduces the "Logical Port Number" which is similar to the
"Port Number" in that it enumerates the ports in the system.

The original (or Physical) "Port Number" can be any number used by the
hardware to uniquely identify a port in the system. The "Logical Port
Number" enumerates all ports in the system from 0 to the number of
ports minus one.

For example a system with 5 ports might have the following port numbers
which would be enumerated thusly:

Port Number:           1  2  5  7  116
Logical Port Number:   0  1  2  3  4

The logical port number is useful when calculating which resources
to use for which peers. So we thus define two helper functions:
ntb_logical_port_number() and ntb_peer_logical_port_number() which
provide the "Logical Port Number" for the local port and any peer
respectively.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Allen Hubbe <allenbh@gmail.com>
Cc: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
include/linux/ntb.h