diff options
author | Joachim Fenkes <fenkes@de.ibm.com> | 2008-04-23 14:55:45 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-23 14:55:45 -0400 |
commit | 863fb09fbf1eb74f56ea02184a62165056aa29cb (patch) | |
tree | 7fb54dd86320f2fba3a6276f5b2fa0e09efed7a3 /drivers/infiniband | |
parent | bc7b3a36ba02e4053ca38653e6a753082d9add03 (diff) |
IB/ehca: Prevent posting of SQ WQEs if QP not in RTS
...as required by IB Spec, C10-29.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_classes.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_qp.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_reqs.c | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 0d13fe0a260b..3d6d9461c31d 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -160,6 +160,7 @@ struct ehca_qp { | |||
160 | }; | 160 | }; |
161 | u32 qp_type; | 161 | u32 qp_type; |
162 | enum ehca_ext_qp_type ext_type; | 162 | enum ehca_ext_qp_type ext_type; |
163 | enum ib_qp_state state; | ||
163 | struct ipz_queue ipz_squeue; | 164 | struct ipz_queue ipz_squeue; |
164 | struct ipz_queue ipz_rqueue; | 165 | struct ipz_queue ipz_rqueue; |
165 | struct h_galpas galpas; | 166 | struct h_galpas galpas; |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 3eb14a52cbf2..5a653d75fd2e 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -550,6 +550,7 @@ static struct ehca_qp *internal_create_qp( | |||
550 | spin_lock_init(&my_qp->spinlock_r); | 550 | spin_lock_init(&my_qp->spinlock_r); |
551 | my_qp->qp_type = qp_type; | 551 | my_qp->qp_type = qp_type; |
552 | my_qp->ext_type = parms.ext_type; | 552 | my_qp->ext_type = parms.ext_type; |
553 | my_qp->state = IB_QPS_RESET; | ||
553 | 554 | ||
554 | if (init_attr->recv_cq) | 555 | if (init_attr->recv_cq) |
555 | my_qp->recv_cq = | 556 | my_qp->recv_cq = |
@@ -1508,6 +1509,8 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1508 | if (attr_mask & IB_QP_QKEY) | 1509 | if (attr_mask & IB_QP_QKEY) |
1509 | my_qp->qkey = attr->qkey; | 1510 | my_qp->qkey = attr->qkey; |
1510 | 1511 | ||
1512 | my_qp->state = qp_new_state; | ||
1513 | |||
1511 | modify_qp_exit2: | 1514 | modify_qp_exit2: |
1512 | if (squeue_locked) { /* this means: sqe -> rts */ | 1515 | if (squeue_locked) { /* this means: sqe -> rts */ |
1513 | spin_unlock_irqrestore(&my_qp->spinlock_s, flags); | 1516 | spin_unlock_irqrestore(&my_qp->spinlock_s, flags); |
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c index a20bbf466188..0b2359e2757a 100644 --- a/drivers/infiniband/hw/ehca/ehca_reqs.c +++ b/drivers/infiniband/hw/ehca/ehca_reqs.c | |||
@@ -421,6 +421,11 @@ int ehca_post_send(struct ib_qp *qp, | |||
421 | int ret = 0; | 421 | int ret = 0; |
422 | unsigned long flags; | 422 | unsigned long flags; |
423 | 423 | ||
424 | if (unlikely(my_qp->state != IB_QPS_RTS)) { | ||
425 | ehca_err(qp->device, "QP not in RTS state qpn=%x", qp->qp_num); | ||
426 | return -EINVAL; | ||
427 | } | ||
428 | |||
424 | /* LOCK the QUEUE */ | 429 | /* LOCK the QUEUE */ |
425 | spin_lock_irqsave(&my_qp->spinlock_s, flags); | 430 | spin_lock_irqsave(&my_qp->spinlock_s, flags); |
426 | 431 | ||