Add two helper functions (ib_lid_cpu16(), ib_lid_be16()) to convert 32 bit lids to 16 bits. Signed-off-by: Don Hiatt <don.hiatt@xxxxxxxxx> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx> --- include/rdma/ib_verbs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index a7d6990..3875ea5d 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -3710,4 +3710,16 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev, else return RDMA_AH_ATTR_TYPE_IB; } + +/* Return lid in 16bit CPU encoding */ +static inline u16 ib_lid_cpu16(u32 lid) +{ + return (u16)lid; +} + +/* Return lid in 16bit BE encoding */ +static inline u16 ib_lid_be16(u32 lid) +{ + return cpu_to_be16((u16)lid); +} #endif /* IB_VERBS_H */ -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html