diff options
author | Ira Weiny <ira.weiny@intel.com> | 2015-05-13 20:02:55 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-05-18 13:35:06 -0400 |
commit | 0cf18d7723055709faf51b50f5a33253b480637f (patch) | |
tree | 4057c072cb7cd39f80c4d35f359010afd17f734f /include | |
parent | 296ec00995fb28c4e34b41f80b5a876f3a25c134 (diff) |
IB/core: Create common start/end port functions
Previously start_port and end_port were defined in 2 places, cache.c and
device.c and this prevented their use in other modules.
Make these common functions, change the name to reflect the rdma
name space, and update existing users.
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/rdma/ib_verbs.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 81740c14fdb1..be4465b5df7b 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -1752,6 +1752,33 @@ int ib_query_port(struct ib_device *device, | |||
1752 | enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, | 1752 | enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, |
1753 | u8 port_num); | 1753 | u8 port_num); |
1754 | 1754 | ||
1755 | /** | ||
1756 | * rdma_start_port - Return the first valid port number for the device | ||
1757 | * specified | ||
1758 | * | ||
1759 | * @device: Device to be checked | ||
1760 | * | ||
1761 | * Return start port number | ||
1762 | */ | ||
1763 | static inline u8 rdma_start_port(const struct ib_device *device) | ||
1764 | { | ||
1765 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; | ||
1766 | } | ||
1767 | |||
1768 | /** | ||
1769 | * rdma_end_port - Return the last valid port number for the device | ||
1770 | * specified | ||
1771 | * | ||
1772 | * @device: Device to be checked | ||
1773 | * | ||
1774 | * Return last port number | ||
1775 | */ | ||
1776 | static inline u8 rdma_end_port(const struct ib_device *device) | ||
1777 | { | ||
1778 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? | ||
1779 | 0 : device->phys_port_cnt; | ||
1780 | } | ||
1781 | |||
1755 | static inline bool rdma_protocol_ib(struct ib_device *device, u8 port_num) | 1782 | static inline bool rdma_protocol_ib(struct ib_device *device, u8 port_num) |
1756 | { | 1783 | { |
1757 | return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB; | 1784 | return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB; |