[openib-general] [PATCH] CM: fix setting default QP attributes
Sean Hefty
mshefty at ichips.intel.com
Wed Jan 26 18:07:35 PST 2005
This should add in setting the path MTU to the default QP attributes. It
also reverses setting the responder_resources and initiator_depth to
match with the correct QP transition.
signed-off-by: Sean Hefty <sean.hefty at intel.com>
Index: core/cm.c
===================================================================
--- core/cm.c (revision 1666)
+++ core/cm.c (working copy)
@@ -115,6 +115,7 @@ struct cm_id_private {
u32 rq_psn;
u64 remote_ca_guid;
int timeout_ms;
+ enum ib_mtu path_mtu;
u8 max_cm_retries;
u8 passive;
u8 peer_to_peer;
@@ -765,7 +766,8 @@ static inline int cm_validate_req_param(
return -EINVAL;
if (param->alternate_path &&
- param->alternate_path->pkey != param->primary_path->pkey)
+ (param->alternate_path->pkey != param->primary_path->pkey ||
+ param->alternate_path->mtu != param->primary_path->mtu))
return -EINVAL;
return 0;
@@ -814,6 +816,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_i
cm_id_priv->initiator_depth = param->initiator_depth;
cm_id_priv->responder_resources = param->responder_resources;
cm_id_priv->retry_count = param->retry_count;
+ cm_id_priv->path_mtu = param->primary_path->mtu;
ret = cm_alloc_msg(cm_id_priv, &cm_id_priv->msg);
if (ret)
@@ -882,7 +885,7 @@ static inline void cm_format_paths_from_
primary_path->pkey = req_msg->pkey;
primary_path->sl = cm_req_get_primary_sl(req_msg);
primary_path->mtu_selector = IB_SA_EQ;
- primary_path->mtu = cm_req_get_mtu(req_msg);
+ primary_path->mtu = cm_req_get_path_mtu(req_msg);
primary_path->rate_selector = IB_SA_EQ;
primary_path->rate = cm_req_get_primary_packet_rate(req_msg);
primary_path->packet_life_time_selector = IB_SA_EQ;
@@ -902,7 +905,7 @@ static inline void cm_format_paths_from_
alt_path->pkey = req_msg->pkey;
alt_path->sl = cm_req_get_alt_sl(req_msg);
alt_path->mtu_selector = IB_SA_EQ;
- alt_path->mtu = cm_req_get_mtu(req_msg);
+ alt_path->mtu = cm_req_get_path_mtu(req_msg);
alt_path->rate_selector = IB_SA_EQ;
alt_path->rate = cm_req_get_alt_packet_rate(req_msg);
alt_path->packet_life_time_selector = IB_SA_EQ;
@@ -1072,6 +1075,7 @@ static int cm_req_handler(struct cm_work
cm_id_priv->remote_qpn = cm_req_get_local_qpn(req_msg);
cm_id_priv->initiator_depth = cm_req_get_resp_res(req_msg);
cm_id_priv->responder_resources = cm_req_get_init_depth(req_msg);
+ cm_id_priv->path_mtu = cm_req_get_path_mtu(req_msg);
cm_id_priv->sq_psn = cm_req_get_starting_psn(req_msg);
cm_id_priv->local_ack_timeout =
cm_req_get_primary_local_ack_timeout(req_msg);
@@ -2587,13 +2591,14 @@ static int cm_init_qp_rtr_attr(struct cm
case IB_CM_REP_SENT:
case IB_CM_MRA_REP_RCVD:
case IB_CM_ESTABLISHED:
- *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_DEST_QPN |
- IB_QP_RQ_PSN | IB_QP_MAX_QP_RD_ATOMIC |
- IB_QP_MIN_RNR_TIMER;
+ *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU |
+ IB_QP_DEST_QPN | IB_QP_RQ_PSN |
+ IB_QP_MAX_DEST_RD_ATOMIC | IB_QP_MIN_RNR_TIMER;
qp_attr->ah_attr = cm_id_priv->av.ah_attr;
+ qp_attr->path_mtu = cm_id_priv->path_mtu;
qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn);
qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn);
- qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
+ qp_attr->max_dest_rd_atomic = cm_id_priv->responder_resources;
qp_attr->min_rnr_timer = 0;
if (cm_id_priv->alt_av.ah_attr.dlid) {
*qp_attr_mask |= IB_QP_ALT_PATH;
@@ -2625,15 +2630,15 @@ static int cm_init_qp_rts_attr(struct cm
case IB_CM_ESTABLISHED:
*qp_attr_mask = IB_QP_STATE | IB_QP_TIMEOUT | IB_QP_RETRY_CNT |
IB_QP_RNR_RETRY | IB_QP_SQ_PSN |
- IB_QP_MAX_DEST_RD_ATOMIC;
+ IB_QP_MAX_QP_RD_ATOMIC;
qp_attr->timeout = cm_id_priv->local_ack_timeout;
qp_attr->retry_cnt = cm_id_priv->retry_count;
qp_attr->rnr_retry = cm_id_priv->rnr_retry_count;
qp_attr->sq_psn = cm_id_priv->sq_psn;
- qp_attr->max_dest_rd_atomic = cm_id_priv->responder_resources;
+ qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
if (cm_id_priv->alt_av.ah_attr.dlid) {
*qp_attr_mask |= IB_QP_PATH_MIG_STATE;
- qp_attr->path_mig_state = IB_MIG_ARMED;
+ qp_attr->path_mig_state = IB_MIG_REARM;
}
ret = 0;
break;
Index: core/cm_msgs.h
===================================================================
--- core/cm_msgs.h (revision 1665)
+++ core/cm_msgs.h (working copy)
@@ -244,7 +244,7 @@ static inline void cm_req_set_retry_coun
(be32_to_cpu(req_msg->offset44) & 0xFFFFFFF8));
}
-static inline u8 cm_req_get_mtu(struct cm_req_msg *req_msg)
+static inline u8 cm_req_get_path_mtu(struct cm_req_msg *req_msg)
{
return req_msg->offset50 >> 4;
}
More information about the general
mailing list