]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/amso1100/c2_qp.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / amso1100 / c2_qp.c
index 179d005ed4a52f18293f76b432b7117169f64c75..a6d89440ad2c737d480508ee2e1010ff2dfbc1b8 100644 (file)
@@ -121,7 +121,7 @@ void c2_set_qp_state(struct c2_qp *qp, int c2_state)
        int new_state = to_ib_state(c2_state);
 
        pr_debug("%s: qp[%p] state modify %s --> %s\n",
-              __FUNCTION__,
+              __func__,
                qp,
                to_ib_state_str(qp->state),
                to_ib_state_str(new_state));
@@ -141,7 +141,7 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
        int err;
 
        pr_debug("%s:%d qp=%p, %s --> %s\n",
-               __FUNCTION__, __LINE__,
+               __func__, __LINE__,
                qp,
                to_ib_state_str(qp->state),
                to_ib_state_str(attr->qp_state));
@@ -161,8 +161,10 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
 
        if (attr_mask & IB_QP_STATE) {
                /* Ensure the state is valid */
-               if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR)
-                       return -EINVAL;
+               if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR) {
+                       err = -EINVAL;
+                       goto bail0;
+               }
 
                wr.next_qp_state = cpu_to_be32(to_c2_state(attr->qp_state));
 
@@ -184,9 +186,10 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
                if (attr->cur_qp_state != IB_QPS_RTR &&
                    attr->cur_qp_state != IB_QPS_RTS &&
                    attr->cur_qp_state != IB_QPS_SQD &&
-                   attr->cur_qp_state != IB_QPS_SQE)
-                       return -EINVAL;
-               else
+                   attr->cur_qp_state != IB_QPS_SQE) {
+                       err = -EINVAL;
+                       goto bail0;
+               } else
                        wr.next_qp_state =
                            cpu_to_be32(to_c2_state(attr->cur_qp_state));
 
@@ -221,7 +224,7 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
                qp->state = next_state;
 #ifdef DEBUG
        else
-               pr_debug("%s: c2_errno=%d\n", __FUNCTION__, err);
+               pr_debug("%s: c2_errno=%d\n", __func__, err);
 #endif
        /*
         * If we're going to error and generating the event here, then
@@ -240,7 +243,7 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
        vq_req_free(c2dev, vq_req);
 
        pr_debug("%s:%d qp=%p, cur_state=%s\n",
-               __FUNCTION__, __LINE__,
+               __func__, __LINE__,
                qp,
                to_ib_state_str(qp->state));
        return err;
@@ -503,6 +506,7 @@ int c2_alloc_qp(struct c2_dev *c2dev,
        qp->send_sgl_depth = qp_attrs->cap.max_send_sge;
        qp->rdma_write_sgl_depth = qp_attrs->cap.max_send_sge;
        qp->recv_sgl_depth = qp_attrs->cap.max_recv_sge;
+       init_waitqueue_head(&qp->wait);
 
        /* Initialize the SQ MQ */
        q_size = be32_to_cpu(reply->sq_depth);
@@ -807,16 +811,24 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr,
 
                switch (ib_wr->opcode) {
                case IB_WR_SEND:
-                       if (ib_wr->send_flags & IB_SEND_SOLICITED) {
-                               c2_wr_set_id(&wr, C2_WR_TYPE_SEND_SE);
-                               msg_size = sizeof(struct c2wr_send_req);
+               case IB_WR_SEND_WITH_INV:
+                       if (ib_wr->opcode == IB_WR_SEND) {
+                               if (ib_wr->send_flags & IB_SEND_SOLICITED)
+                                       c2_wr_set_id(&wr, C2_WR_TYPE_SEND_SE);
+                               else
+                                       c2_wr_set_id(&wr, C2_WR_TYPE_SEND);
+                               wr.sqwr.send.remote_stag = 0;
                        } else {
-                               c2_wr_set_id(&wr, C2_WR_TYPE_SEND);
-                               msg_size = sizeof(struct c2wr_send_req);
+                               if (ib_wr->send_flags & IB_SEND_SOLICITED)
+                                       c2_wr_set_id(&wr, C2_WR_TYPE_SEND_SE_INV);
+                               else
+                                       c2_wr_set_id(&wr, C2_WR_TYPE_SEND_INV);
+                               wr.sqwr.send.remote_stag =
+                                       cpu_to_be32(ib_wr->ex.invalidate_rkey);
                        }
 
-                       wr.sqwr.send.remote_stag = 0;
-                       msg_size += sizeof(struct c2_data_addr) * ib_wr->num_sge;
+                       msg_size = sizeof(struct c2wr_send_req) +
+                               sizeof(struct c2_data_addr) * ib_wr->num_sge;
                        if (ib_wr->num_sge > qp->send_sgl_depth) {
                                err = -EINVAL;
                                break;