enum rdma_ah_attr_type {
RDMA_AH_ATTR_TYPE_IB,
RDMA_AH_ATTR_TYPE_ROCE,
+ RDMA_AH_ATTR_TYPE_OPA,
};
struct ib_ah_attr {
u8 dmac[ETH_ALEN];
};
+struct opa_ah_attr {
+ u32 dlid;
+ u8 src_path_bits;
+};
+
struct rdma_ah_attr {
struct ib_global_route grh;
u8 sl;
union {
struct ib_ah_attr ib;
struct roce_ah_attr roce;
+ struct opa_ah_attr opa;
};
};
return NULL;
}
-static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u16 dlid)
+static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u32 dlid)
{
if (attr->type == RDMA_AH_ATTR_TYPE_IB)
- attr->ib.dlid = dlid;
+ attr->ib.dlid = (u16)dlid;
+ else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+ attr->opa.dlid = dlid;
}
-static inline u16 rdma_ah_get_dlid(const struct rdma_ah_attr *attr)
+static inline u32 rdma_ah_get_dlid(const struct rdma_ah_attr *attr)
{
if (attr->type == RDMA_AH_ATTR_TYPE_IB)
return attr->ib.dlid;
+ else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+ return attr->opa.dlid;
return 0;
}
{
if (attr->type == RDMA_AH_ATTR_TYPE_IB)
attr->ib.src_path_bits = src_path_bits;
+ else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+ attr->opa.src_path_bits = src_path_bits;
}
static inline u8 rdma_ah_get_path_bits(const struct rdma_ah_attr *attr)
{
if (attr->type == RDMA_AH_ATTR_TYPE_IB)
return attr->ib.src_path_bits;
+ else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+ return attr->opa.src_path_bits;
return 0;
}
if ((rdma_protocol_roce(dev, port_num)) ||
(rdma_protocol_iwarp(dev, port_num)))
return RDMA_AH_ATTR_TYPE_ROCE;
+ else if ((rdma_protocol_ib(dev, port_num)) &&
+ (rdma_cap_opa_ah(dev, port_num)))
+ return RDMA_AH_ATTR_TYPE_OPA;
else
return RDMA_AH_ATTR_TYPE_IB;
}