summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYuval Shaia <yuval.shaia@oracle.com>2017-01-25 18:41:37 +0200
committerBen Hutchings <ben@decadent.org.uk>2017-10-12 15:28:00 +0100
commit9dfc4a5a483dc9e7473d28a3b2b475f4cc3e6985 (patch)
treefef42c359ed4aa33bb0bd0ffb334d4c431338d31 /include
parentad84b0f7ee017b5eb0819f79bf00e47b4290ce32 (diff)
IB/core: Add inline function to validate port
commit 24dc831b77eca9361cf835be59fa69ea0e471afc upstream. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com> [bwh: Backported to 3.16: - Drop inapplicable changes - Adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/rdma/ib_verbs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 69cd66432b2a..7367f8c9aeeb 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1721,6 +1721,13 @@ static inline u8 rdma_end_port(const struct ib_device *device)
0 : device->phys_port_cnt;
}
+static inline int rdma_is_port_valid(const struct ib_device *device,
+ unsigned int port)
+{
+ return (port >= rdma_start_port(device) &&
+ port <= rdma_end_port(device));
+}
+
int ib_query_gid(struct ib_device *device,
u8 port_num, int index, union ib_gid *gid);