diff options
author | Sean Hefty <sean.hefty@intel.com> | 2005-10-24 15:33:56 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-10-24 15:33:56 -0400 |
commit | ae7971a7706384ca373fb7e212fe195698e6c5a1 (patch) | |
tree | 5c0d0fecf3faa6c899f8438c4589fa8dede9da72 | |
parent | ec329a135974f1c400214dab02f09584d4beeba9 (diff) |
[IB] CM: Fix initialization of QP attributes for UC QPs.
Fix cm_init_qp_init_attr(), cm_init_qp_rtr_attr() and cm_init_qp_rts_attr()
so that they correctly handle the differences between UC and RC QPs. This
fixes problems with setting up UC QPs through the CM.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/core/cm.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 3fe6f4754fa8..389fecbaf662 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -135,6 +135,7 @@ struct cm_id_private { | |||
135 | __be64 tid; | 135 | __be64 tid; |
136 | __be32 local_qpn; | 136 | __be32 local_qpn; |
137 | __be32 remote_qpn; | 137 | __be32 remote_qpn; |
138 | enum ib_qp_type qp_type; | ||
138 | __be32 sq_psn; | 139 | __be32 sq_psn; |
139 | __be32 rq_psn; | 140 | __be32 rq_psn; |
140 | int timeout_ms; | 141 | int timeout_ms; |
@@ -926,6 +927,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, | |||
926 | cm_id_priv->responder_resources = param->responder_resources; | 927 | cm_id_priv->responder_resources = param->responder_resources; |
927 | cm_id_priv->retry_count = param->retry_count; | 928 | cm_id_priv->retry_count = param->retry_count; |
928 | cm_id_priv->path_mtu = param->primary_path->mtu; | 929 | cm_id_priv->path_mtu = param->primary_path->mtu; |
930 | cm_id_priv->qp_type = param->qp_type; | ||
929 | 931 | ||
930 | ret = cm_alloc_msg(cm_id_priv, &cm_id_priv->msg); | 932 | ret = cm_alloc_msg(cm_id_priv, &cm_id_priv->msg); |
931 | if (ret) | 933 | if (ret) |
@@ -1320,6 +1322,7 @@ static int cm_req_handler(struct cm_work *work) | |||
1320 | cm_req_get_primary_local_ack_timeout(req_msg); | 1322 | cm_req_get_primary_local_ack_timeout(req_msg); |
1321 | cm_id_priv->retry_count = cm_req_get_retry_count(req_msg); | 1323 | cm_id_priv->retry_count = cm_req_get_retry_count(req_msg); |
1322 | cm_id_priv->rnr_retry_count = cm_req_get_rnr_retry_count(req_msg); | 1324 | cm_id_priv->rnr_retry_count = cm_req_get_rnr_retry_count(req_msg); |
1325 | cm_id_priv->qp_type = cm_req_get_qp_type(req_msg); | ||
1323 | 1326 | ||
1324 | cm_format_req_event(work, cm_id_priv, &listen_cm_id_priv->id); | 1327 | cm_format_req_event(work, cm_id_priv, &listen_cm_id_priv->id); |
1325 | cm_process_work(cm_id_priv, work); | 1328 | cm_process_work(cm_id_priv, work); |
@@ -3079,10 +3082,10 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, | |||
3079 | case IB_CM_ESTABLISHED: | 3082 | case IB_CM_ESTABLISHED: |
3080 | *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | | 3083 | *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | |
3081 | IB_QP_PKEY_INDEX | IB_QP_PORT; | 3084 | IB_QP_PKEY_INDEX | IB_QP_PORT; |
3082 | qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE; | 3085 | qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | |
3086 | IB_ACCESS_REMOTE_WRITE; | ||
3083 | if (cm_id_priv->responder_resources) | 3087 | if (cm_id_priv->responder_resources) |
3084 | qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_WRITE | | 3088 | qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ; |
3085 | IB_ACCESS_REMOTE_READ; | ||
3086 | qp_attr->pkey_index = cm_id_priv->av.pkey_index; | 3089 | qp_attr->pkey_index = cm_id_priv->av.pkey_index; |
3087 | qp_attr->port_num = cm_id_priv->av.port->port_num; | 3090 | qp_attr->port_num = cm_id_priv->av.port->port_num; |
3088 | ret = 0; | 3091 | ret = 0; |
@@ -3112,14 +3115,18 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv, | |||
3112 | case IB_CM_MRA_REP_RCVD: | 3115 | case IB_CM_MRA_REP_RCVD: |
3113 | case IB_CM_ESTABLISHED: | 3116 | case IB_CM_ESTABLISHED: |
3114 | *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU | | 3117 | *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU | |
3115 | IB_QP_DEST_QPN | IB_QP_RQ_PSN | | 3118 | IB_QP_DEST_QPN | IB_QP_RQ_PSN; |
3116 | IB_QP_MAX_DEST_RD_ATOMIC | IB_QP_MIN_RNR_TIMER; | ||
3117 | qp_attr->ah_attr = cm_id_priv->av.ah_attr; | 3119 | qp_attr->ah_attr = cm_id_priv->av.ah_attr; |
3118 | qp_attr->path_mtu = cm_id_priv->path_mtu; | 3120 | qp_attr->path_mtu = cm_id_priv->path_mtu; |
3119 | qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); | 3121 | qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); |
3120 | qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); | 3122 | qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); |
3121 | qp_attr->max_dest_rd_atomic = cm_id_priv->responder_resources; | 3123 | if (cm_id_priv->qp_type == IB_QPT_RC) { |
3122 | qp_attr->min_rnr_timer = 0; | 3124 | *qp_attr_mask |= IB_QP_MAX_DEST_RD_ATOMIC | |
3125 | IB_QP_MIN_RNR_TIMER; | ||
3126 | qp_attr->max_dest_rd_atomic = | ||
3127 | cm_id_priv->responder_resources; | ||
3128 | qp_attr->min_rnr_timer = 0; | ||
3129 | } | ||
3123 | if (cm_id_priv->alt_av.ah_attr.dlid) { | 3130 | if (cm_id_priv->alt_av.ah_attr.dlid) { |
3124 | *qp_attr_mask |= IB_QP_ALT_PATH; | 3131 | *qp_attr_mask |= IB_QP_ALT_PATH; |
3125 | qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr; | 3132 | qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr; |
@@ -3148,14 +3155,17 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv, | |||
3148 | case IB_CM_REP_SENT: | 3155 | case IB_CM_REP_SENT: |
3149 | case IB_CM_MRA_REP_RCVD: | 3156 | case IB_CM_MRA_REP_RCVD: |
3150 | case IB_CM_ESTABLISHED: | 3157 | case IB_CM_ESTABLISHED: |
3151 | *qp_attr_mask = IB_QP_STATE | IB_QP_TIMEOUT | IB_QP_RETRY_CNT | | 3158 | *qp_attr_mask = IB_QP_STATE | IB_QP_SQ_PSN; |
3152 | IB_QP_RNR_RETRY | IB_QP_SQ_PSN | | ||
3153 | IB_QP_MAX_QP_RD_ATOMIC; | ||
3154 | qp_attr->timeout = cm_id_priv->local_ack_timeout; | ||
3155 | qp_attr->retry_cnt = cm_id_priv->retry_count; | ||
3156 | qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; | ||
3157 | qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn); | 3159 | qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn); |
3158 | qp_attr->max_rd_atomic = cm_id_priv->initiator_depth; | 3160 | if (cm_id_priv->qp_type == IB_QPT_RC) { |
3161 | *qp_attr_mask |= IB_QP_TIMEOUT | IB_QP_RETRY_CNT | | ||
3162 | IB_QP_RNR_RETRY | | ||
3163 | IB_QP_MAX_QP_RD_ATOMIC; | ||
3164 | qp_attr->timeout = cm_id_priv->local_ack_timeout; | ||
3165 | qp_attr->retry_cnt = cm_id_priv->retry_count; | ||
3166 | qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; | ||
3167 | qp_attr->max_rd_atomic = cm_id_priv->initiator_depth; | ||
3168 | } | ||
3159 | if (cm_id_priv->alt_av.ah_attr.dlid) { | 3169 | if (cm_id_priv->alt_av.ah_attr.dlid) { |
3160 | *qp_attr_mask |= IB_QP_PATH_MIG_STATE; | 3170 | *qp_attr_mask |= IB_QP_PATH_MIG_STATE; |
3161 | qp_attr->path_mig_state = IB_MIG_REARM; | 3171 | qp_attr->path_mig_state = IB_MIG_REARM; |