IB/core: Use rdma_ah_attr accessor functions
Modify core and driver components to use accessor functions introduced to access individual fields of rdma_ah_attr Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Don Hiatt <don.hiatt@intel.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

orang tua
2224c47ace
melakukan
d8966fcd4c
@@ -63,29 +63,32 @@ int rvt_check_ah(struct ib_device *ibdev,
|
||||
struct rdma_ah_attr *ah_attr)
|
||||
{
|
||||
int err;
|
||||
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,
|
||||
ah_attr->port_num);
|
||||
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);
|
||||
|
||||
err = ib_query_port(ibdev, ah_attr->port_num, &port_attr);
|
||||
err = ib_query_port(ibdev, port_num, &port_attr);
|
||||
if (err)
|
||||
return -EINVAL;
|
||||
if (ah_attr->port_num < 1 ||
|
||||
ah_attr->port_num > ibdev->phys_port_cnt)
|
||||
if (port_num < 1 ||
|
||||
port_num > ibdev->phys_port_cnt)
|
||||
return -EINVAL;
|
||||
if (ah_attr->static_rate != IB_RATE_PORT_CURRENT &&
|
||||
ib_rate_to_mbps(ah_attr->static_rate) < 0)
|
||||
if (static_rate != IB_RATE_PORT_CURRENT &&
|
||||
ib_rate_to_mbps(static_rate) < 0)
|
||||
return -EINVAL;
|
||||
if ((ah_attr->ah_flags & IB_AH_GRH) &&
|
||||
ah_attr->grh.sgid_index >= port_attr.gid_tbl_len)
|
||||
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 (ah_attr->dlid == 0)
|
||||
if (dlid == 0)
|
||||
return -EINVAL;
|
||||
if (ah_attr->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) &&
|
||||
ah_attr->dlid != be16_to_cpu(IB_LID_PERMISSIVE) &&
|
||||
!(ah_attr->ah_flags & IB_AH_GRH))
|
||||
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)
|
||||
|
@@ -1104,14 +1104,15 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
goto inval;
|
||||
|
||||
if (attr_mask & IB_QP_AV) {
|
||||
if (attr->ah_attr.dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
|
||||
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 (attr->alt_ah_attr.dlid >=
|
||||
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))
|
||||
@@ -1240,7 +1241,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
|
||||
if (attr_mask & IB_QP_AV) {
|
||||
qp->remote_ah_attr = attr->ah_attr;
|
||||
qp->s_srate = attr->ah_attr.static_rate;
|
||||
qp->s_srate = rdma_ah_get_static_rate(&attr->ah_attr);
|
||||
qp->srate_mbps = ib_rate_to_mbps(qp->s_srate);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1254,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
qp->s_mig_state = attr->path_mig_state;
|
||||
if (mig) {
|
||||
qp->remote_ah_attr = qp->alt_ah_attr;
|
||||
qp->port_num = qp->alt_ah_attr.port_num;
|
||||
qp->port_num = rdma_ah_get_port_num(&qp->alt_ah_attr);
|
||||
qp->s_pkey_index = qp->s_alt_pkey_index;
|
||||
}
|
||||
}
|
||||
@@ -1424,7 +1425,8 @@ int rvt_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
attr->timeout = qp->timeout;
|
||||
attr->retry_cnt = qp->s_retry_cnt;
|
||||
attr->rnr_retry = qp->s_rnr_retry_cnt;
|
||||
attr->alt_port_num = qp->alt_ah_attr.port_num;
|
||||
attr->alt_port_num =
|
||||
rdma_ah_get_port_num(&qp->alt_ah_attr);
|
||||
attr->alt_timeout = qp->alt_timeout;
|
||||
|
||||
init_attr->event_handler = qp->ibqp.event_handler;
|
||||
|
Reference in New Issue
Block a user