diff options
author | Yuval Shaia <yuval.shaia@oracle.com> | 2017-01-25 18:41:37 +0200 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-01-27 14:33:59 -0500 |
commit | 24dc831b77eca9361cf835be59fa69ea0e471afc (patch) | |
tree | 5aa6e10dfc77e48e2c969b3f6f870b3fc18f7e5e /include/rdma | |
parent | 2bce1a6d2209c8c776a9598741f5aa1991689dcb (diff) |
IB/core: Add inline function to validate port
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/ib_verbs.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index e55afec6bb84..b1ac9735fbbe 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2280,6 +2280,13 @@ static inline u8 rdma_end_port(const struct ib_device *device) return rdma_cap_ib_switch(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)); +} + static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) { return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IB; |