]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IB/ehca: Prevent posting of SQ WQEs if QP not in RTS
authorJoachim Fenkes <fenkes@de.ibm.com>
Wed, 23 Apr 2008 18:55:45 +0000 (11:55 -0700)
committerRoland Dreier <rolandd@cisco.com>
Wed, 23 Apr 2008 18:55:45 +0000 (11:55 -0700)
...as required by IB Spec, C10-29.

Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ehca/ehca_classes.h
drivers/infiniband/hw/ehca/ehca_qp.c
drivers/infiniband/hw/ehca/ehca_reqs.c

index 0d13fe0a260b182678134ac29acef7ac90bf4648..3d6d9461c31da089eb2aee091a9286e4d994e6e9 100644 (file)
@@ -160,6 +160,7 @@ struct ehca_qp {
        };
        u32 qp_type;
        enum ehca_ext_qp_type ext_type;
+       enum ib_qp_state state;
        struct ipz_queue ipz_squeue;
        struct ipz_queue ipz_rqueue;
        struct h_galpas galpas;
index 3eb14a52cbf2bc4ebb5a2a46c129861a05ebdb28..5a653d75fd2e33e7090fdf6d0cf95c6e02f5e4dc 100644 (file)
@@ -550,6 +550,7 @@ static struct ehca_qp *internal_create_qp(
        spin_lock_init(&my_qp->spinlock_r);
        my_qp->qp_type = qp_type;
        my_qp->ext_type = parms.ext_type;
+       my_qp->state = IB_QPS_RESET;
 
        if (init_attr->recv_cq)
                my_qp->recv_cq =
@@ -1508,6 +1509,8 @@ static int internal_modify_qp(struct ib_qp *ibqp,
        if (attr_mask & IB_QP_QKEY)
                my_qp->qkey = attr->qkey;
 
+       my_qp->state = qp_new_state;
+
 modify_qp_exit2:
        if (squeue_locked) { /* this means: sqe -> rts */
                spin_unlock_irqrestore(&my_qp->spinlock_s, flags);
index a20bbf4661881a095a34aab7cf13f5a443b832df..0b2359e2757a4555019fc9af3c4430f8b59dcbc5 100644 (file)
@@ -421,6 +421,11 @@ int ehca_post_send(struct ib_qp *qp,
        int ret = 0;
        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 */
        spin_lock_irqsave(&my_qp->spinlock_s, flags);