Commit 863fb09f authored by Joachim Fenkes's avatar Joachim Fenkes Committed by Roland Dreier

IB/ehca: Prevent posting of SQ WQEs if QP not in RTS

...as required by IB Spec, C10-29.
Signed-off-by: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent bc7b3a36
...@@ -160,6 +160,7 @@ struct ehca_qp { ...@@ -160,6 +160,7 @@ struct ehca_qp {
}; };
u32 qp_type; u32 qp_type;
enum ehca_ext_qp_type ext_type; enum ehca_ext_qp_type ext_type;
enum ib_qp_state state;
struct ipz_queue ipz_squeue; struct ipz_queue ipz_squeue;
struct ipz_queue ipz_rqueue; struct ipz_queue ipz_rqueue;
struct h_galpas galpas; struct h_galpas galpas;
......
...@@ -550,6 +550,7 @@ static struct ehca_qp *internal_create_qp( ...@@ -550,6 +550,7 @@ static struct ehca_qp *internal_create_qp(
spin_lock_init(&my_qp->spinlock_r); spin_lock_init(&my_qp->spinlock_r);
my_qp->qp_type = qp_type; my_qp->qp_type = qp_type;
my_qp->ext_type = parms.ext_type; my_qp->ext_type = parms.ext_type;
my_qp->state = IB_QPS_RESET;
if (init_attr->recv_cq) if (init_attr->recv_cq)
my_qp->recv_cq = my_qp->recv_cq =
...@@ -1508,6 +1509,8 @@ static int internal_modify_qp(struct ib_qp *ibqp, ...@@ -1508,6 +1509,8 @@ static int internal_modify_qp(struct ib_qp *ibqp,
if (attr_mask & IB_QP_QKEY) if (attr_mask & IB_QP_QKEY)
my_qp->qkey = attr->qkey; my_qp->qkey = attr->qkey;
my_qp->state = qp_new_state;
modify_qp_exit2: modify_qp_exit2:
if (squeue_locked) { /* this means: sqe -> rts */ if (squeue_locked) { /* this means: sqe -> rts */
spin_unlock_irqrestore(&my_qp->spinlock_s, flags); spin_unlock_irqrestore(&my_qp->spinlock_s, flags);
......
...@@ -421,6 +421,11 @@ int ehca_post_send(struct ib_qp *qp, ...@@ -421,6 +421,11 @@ int ehca_post_send(struct ib_qp *qp,
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
if (unlikely(my_qp->state != IB_QPS_RTS)) {
ehca_err(qp->device, "QP not in RTS state qpn=%x", qp->qp_num);
return -EINVAL;
}
/* LOCK the QUEUE */ /* LOCK the QUEUE */
spin_lock_irqsave(&my_qp->spinlock_s, flags); spin_lock_irqsave(&my_qp->spinlock_s, flags);
......
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