IB/rdmavt, hfi1, qib: Modify check_ah() to account for extended LIDs
rvt_check_ah() delegates lid verification to underlying driver. Underlying driver uses different conditions to check for dlid depending on whether the device supports extended LIDs Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Don Hiatt <don.hiatt@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
@@ -66,8 +66,6 @@ int rvt_check_ah(struct ib_device *ibdev,
|
||||
int port_num = rdma_ah_get_port_num(ah_attr);
|
||||
struct ib_port_attr port_attr;
|
||||
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
|
||||
enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
|
||||
u32 dlid = rdma_ah_get_dlid(ah_attr);
|
||||
u8 ah_flags = rdma_ah_get_ah_flags(ah_attr);
|
||||
u8 static_rate = rdma_ah_get_static_rate(ah_attr);
|
||||
|
||||
@@ -83,14 +81,6 @@ int rvt_check_ah(struct ib_device *ibdev,
|
||||
if ((ah_flags & IB_AH_GRH) &&
|
||||
rdma_ah_read_grh(ah_attr)->sgid_index >= port_attr.gid_tbl_len)
|
||||
return -EINVAL;
|
||||
if (link != IB_LINK_LAYER_ETHERNET) {
|
||||
if (dlid == 0)
|
||||
return -EINVAL;
|
||||
if (dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) &&
|
||||
dlid != be16_to_cpu(IB_LID_PERMISSIVE) &&
|
||||
!(ah_flags & IB_AH_GRH))
|
||||
return -EINVAL;
|
||||
}
|
||||
if (rdi->driver_f.check_ah)
|
||||
return rdi->driver_f.check_ah(ibdev, ah_attr);
|
||||
return 0;
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <rdma/ib_hdrs.h>
|
||||
#include <rdma/opa_addr.h>
|
||||
#include "qp.h"
|
||||
#include "vt.h"
|
||||
#include "trace.h"
|
||||
@@ -1066,6 +1067,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
int mig = 0;
|
||||
int pmtu = 0; /* for gcc warning only */
|
||||
enum rdma_link_layer link;
|
||||
int opa_ah;
|
||||
|
||||
link = rdma_port_get_link_layer(ibqp->device, qp->port_num);
|
||||
|
||||
@@ -1076,6 +1078,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
cur_state = attr_mask & IB_QP_CUR_STATE ?
|
||||
attr->cur_qp_state : qp->state;
|
||||
new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
|
||||
opa_ah = rdma_cap_opa_ah(ibqp->device, qp->port_num);
|
||||
|
||||
if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type,
|
||||
attr_mask, link))
|
||||
@@ -1086,17 +1089,31 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
goto inval;
|
||||
|
||||
if (attr_mask & IB_QP_AV) {
|
||||
if (rdma_ah_get_dlid(&attr->ah_attr) >=
|
||||
be16_to_cpu(IB_MULTICAST_LID_BASE))
|
||||
goto inval;
|
||||
if (opa_ah) {
|
||||
if (rdma_ah_get_dlid(&attr->ah_attr) >=
|
||||
opa_get_mcast_base(OPA_MCAST_NR))
|
||||
goto inval;
|
||||
} else {
|
||||
if (rdma_ah_get_dlid(&attr->ah_attr) >=
|
||||
be16_to_cpu(IB_MULTICAST_LID_BASE))
|
||||
goto inval;
|
||||
}
|
||||
|
||||
if (rvt_check_ah(qp->ibqp.device, &attr->ah_attr))
|
||||
goto inval;
|
||||
}
|
||||
|
||||
if (attr_mask & IB_QP_ALT_PATH) {
|
||||
if (rdma_ah_get_dlid(&attr->alt_ah_attr) >=
|
||||
be16_to_cpu(IB_MULTICAST_LID_BASE))
|
||||
goto inval;
|
||||
if (opa_ah) {
|
||||
if (rdma_ah_get_dlid(&attr->alt_ah_attr) >=
|
||||
opa_get_mcast_base(OPA_MCAST_NR))
|
||||
goto inval;
|
||||
} else {
|
||||
if (rdma_ah_get_dlid(&attr->alt_ah_attr) >=
|
||||
be16_to_cpu(IB_MULTICAST_LID_BASE))
|
||||
goto inval;
|
||||
}
|
||||
|
||||
if (rvt_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
|
||||
goto inval;
|
||||
if (attr->alt_pkey_index >= rvt_get_npkeys(rdi))
|
||||
|
Reference in New Issue
Block a user