Commit 4cd5060c authored by Patrick Marchand Latifi's avatar Patrick Marchand Latifi Committed by Roland Dreier

IB/ipath: Fix RC QP initialization

This patch fixes the initialization of RC QPs, since we would rely on
the queue pair type (ibqp->qp_type) being set, but this field is only
initialized when we return from ipath_create_qp (it is initialized by
the user-level verbs library).

The fix is to not depend on this field to initialize the send and
the receive state of the RC QP.
Signed-off-by: default avatarPatrick Marchand Latifi <patrick.latifi@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 87d5aed8
...@@ -329,8 +329,9 @@ struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn) ...@@ -329,8 +329,9 @@ struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn)
/** /**
* ipath_reset_qp - initialize the QP state to the reset state * ipath_reset_qp - initialize the QP state to the reset state
* @qp: the QP to reset * @qp: the QP to reset
* @type: the QP type
*/ */
static void ipath_reset_qp(struct ipath_qp *qp) static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
{ {
qp->remote_qpn = 0; qp->remote_qpn = 0;
qp->qkey = 0; qp->qkey = 0;
...@@ -342,7 +343,7 @@ static void ipath_reset_qp(struct ipath_qp *qp) ...@@ -342,7 +343,7 @@ static void ipath_reset_qp(struct ipath_qp *qp)
qp->s_psn = 0; qp->s_psn = 0;
qp->r_psn = 0; qp->r_psn = 0;
qp->r_msn = 0; qp->r_msn = 0;
if (qp->ibqp.qp_type == IB_QPT_RC) { if (type == IB_QPT_RC) {
qp->s_state = IB_OPCODE_RC_SEND_LAST; qp->s_state = IB_OPCODE_RC_SEND_LAST;
qp->r_state = IB_OPCODE_RC_SEND_LAST; qp->r_state = IB_OPCODE_RC_SEND_LAST;
} else { } else {
...@@ -534,7 +535,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, ...@@ -534,7 +535,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
switch (new_state) { switch (new_state) {
case IB_QPS_RESET: case IB_QPS_RESET:
ipath_reset_qp(qp); ipath_reset_qp(qp, ibqp->qp_type);
break; break;
case IB_QPS_ERR: case IB_QPS_ERR:
...@@ -839,7 +840,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, ...@@ -839,7 +840,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
goto bail_qp; goto bail_qp;
} }
qp->ip = NULL; qp->ip = NULL;
ipath_reset_qp(qp); ipath_reset_qp(qp, init_attr->qp_type);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment