Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Sean Hefty and committed by
Roland Dreier
ae7971a7 ec329a13

+24 -14
+24 -14
drivers/infiniband/core/cm.c
··· 135 135 __be64 tid; 136 136 __be32 local_qpn; 137 137 __be32 remote_qpn; 138 + enum ib_qp_type qp_type; 138 139 __be32 sq_psn; 139 140 __be32 rq_psn; 140 141 int timeout_ms; ··· 927 926 cm_id_priv->responder_resources = param->responder_resources; 928 927 cm_id_priv->retry_count = param->retry_count; 929 928 cm_id_priv->path_mtu = param->primary_path->mtu; 929 + cm_id_priv->qp_type = param->qp_type; 930 930 931 931 ret = cm_alloc_msg(cm_id_priv, &cm_id_priv->msg); 932 932 if (ret) ··· 1322 1320 cm_req_get_primary_local_ack_timeout(req_msg); 1323 1321 cm_id_priv->retry_count = cm_req_get_retry_count(req_msg); 1324 1322 cm_id_priv->rnr_retry_count = cm_req_get_rnr_retry_count(req_msg); 1323 + cm_id_priv->qp_type = cm_req_get_qp_type(req_msg); 1325 1324 1326 1325 cm_format_req_event(work, cm_id_priv, &listen_cm_id_priv->id); 1327 1326 cm_process_work(cm_id_priv, work); ··· 3082 3079 case IB_CM_ESTABLISHED: 3083 3080 *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | 3084 3081 IB_QP_PKEY_INDEX | IB_QP_PORT; 3085 - qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE; 3082 + qp_attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | 3083 + IB_ACCESS_REMOTE_WRITE; 3086 3084 if (cm_id_priv->responder_resources) 3087 - qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_WRITE | 3088 - IB_ACCESS_REMOTE_READ; 3085 + qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ; 3089 3086 qp_attr->pkey_index = cm_id_priv->av.pkey_index; 3090 3087 qp_attr->port_num = cm_id_priv->av.port->port_num; 3091 3088 ret = 0; ··· 3115 3112 case IB_CM_MRA_REP_RCVD: 3116 3113 case IB_CM_ESTABLISHED: 3117 3114 *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU | 3118 - IB_QP_DEST_QPN | IB_QP_RQ_PSN | 3119 - IB_QP_MAX_DEST_RD_ATOMIC | IB_QP_MIN_RNR_TIMER; 3115 + IB_QP_DEST_QPN | IB_QP_RQ_PSN; 3120 3116 qp_attr->ah_attr = cm_id_priv->av.ah_attr; 3121 3117 qp_attr->path_mtu = cm_id_priv->path_mtu; 3122 3118 qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); 3123 3119 qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); 3124 - qp_attr->max_dest_rd_atomic = cm_id_priv->responder_resources; 3125 - qp_attr->min_rnr_timer = 0; 3120 + if (cm_id_priv->qp_type == IB_QPT_RC) { 3121 + *qp_attr_mask |= IB_QP_MAX_DEST_RD_ATOMIC | 3122 + IB_QP_MIN_RNR_TIMER; 3123 + qp_attr->max_dest_rd_atomic = 3124 + cm_id_priv->responder_resources; 3125 + qp_attr->min_rnr_timer = 0; 3126 + } 3126 3127 if (cm_id_priv->alt_av.ah_attr.dlid) { 3127 3128 *qp_attr_mask |= IB_QP_ALT_PATH; 3128 3129 qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr; ··· 3155 3148 case IB_CM_REP_SENT: 3156 3149 case IB_CM_MRA_REP_RCVD: 3157 3150 case IB_CM_ESTABLISHED: 3158 - *qp_attr_mask = IB_QP_STATE | IB_QP_TIMEOUT | IB_QP_RETRY_CNT | 3159 - IB_QP_RNR_RETRY | IB_QP_SQ_PSN | 3160 - IB_QP_MAX_QP_RD_ATOMIC; 3161 - qp_attr->timeout = cm_id_priv->local_ack_timeout; 3162 - qp_attr->retry_cnt = cm_id_priv->retry_count; 3163 - qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; 3151 + *qp_attr_mask = IB_QP_STATE | IB_QP_SQ_PSN; 3164 3152 qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn); 3165 - qp_attr->max_rd_atomic = cm_id_priv->initiator_depth; 3153 + if (cm_id_priv->qp_type == IB_QPT_RC) { 3154 + *qp_attr_mask |= IB_QP_TIMEOUT | IB_QP_RETRY_CNT | 3155 + IB_QP_RNR_RETRY | 3156 + IB_QP_MAX_QP_RD_ATOMIC; 3157 + qp_attr->timeout = cm_id_priv->local_ack_timeout; 3158 + qp_attr->retry_cnt = cm_id_priv->retry_count; 3159 + qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; 3160 + qp_attr->max_rd_atomic = cm_id_priv->initiator_depth; 3161 + } 3166 3162 if (cm_id_priv->alt_av.ah_attr.dlid) { 3167 3163 *qp_attr_mask |= IB_QP_PATH_MIG_STATE; 3168 3164 qp_attr->path_mig_state = IB_MIG_REARM;