aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma')
-rw-r--r--include/rdma/ib_verbs.h27
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,
1752enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, 1752enum 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 */
1763static 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 */
1776static 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
1755static inline bool rdma_protocol_ib(struct ib_device *device, u8 port_num) 1782static 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;