aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/opa_addr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/opa_addr.h')
-rw-r--r--include/rdma/opa_addr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h
index f68fca296631..2bbb7a67e643 100644
--- a/include/rdma/opa_addr.h
+++ b/include/rdma/opa_addr.h
@@ -114,4 +114,20 @@ static inline u32 opa_get_mcast_base(u32 nr_top_bits)
114 return (be32_to_cpu(OPA_LID_PERMISSIVE) << (32 - nr_top_bits)); 114 return (be32_to_cpu(OPA_LID_PERMISSIVE) << (32 - nr_top_bits));
115} 115}
116 116
117/* Check for a valid unicast LID for non-SM traffic types */
118static inline bool rdma_is_valid_unicast_lid(struct rdma_ah_attr *attr)
119{
120 if (attr->type == RDMA_AH_ATTR_TYPE_IB) {
121 if (!rdma_ah_get_dlid(attr) ||
122 rdma_ah_get_dlid(attr) >=
123 be32_to_cpu(IB_MULTICAST_LID_BASE))
124 return false;
125 } else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) {
126 if (!rdma_ah_get_dlid(attr) ||
127 rdma_ah_get_dlid(attr) >=
128 opa_get_mcast_base(OPA_MCAST_NR))
129 return false;
130 }
131 return true;
132}
117#endif /* OPA_ADDR_H */ 133#endif /* OPA_ADDR_H */