]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/ipath/ipath_ud.c
IB/mthca: Avoid changing userspace ABI to handle DMA write barrier attribute
[linux-2.6] / drivers / infiniband / hw / ipath / ipath_ud.c
index 16a2a938b520517ae74c9746450df2a0d436c06a..8b6a261c89e328de7f9c4a230aa528d5e980eff0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007, 2008 QLogic Corporation. All rights reserved.
  * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -95,7 +95,7 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
 
        if (swqe->wr.opcode == IB_WR_SEND_WITH_IMM) {
                wc.wc_flags = IB_WC_WITH_IMM;
-               wc.imm_data = swqe->wr.imm_data;
+               wc.imm_data = swqe->wr.ex.imm_data;
        } else {
                wc.wc_flags = 0;
                wc.imm_data = 0;
@@ -301,10 +301,9 @@ int ipath_make_ud_req(struct ipath_qp *qp)
 
        /* header size in 32-bit words LRH+BTH+DETH = (8+12+8)/4. */
        qp->s_hdrwords = 7;
-       if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM)
-               qp->s_hdrwords++;
        qp->s_cur_size = wqe->length;
        qp->s_cur_sge = &qp->s_sge;
+       qp->s_dmult = ah_attr->static_rate;
        qp->s_wqe = wqe;
        qp->s_sge.sge = wqe->sg_list[0];
        qp->s_sge.sg_list = wqe->sg_list + 1;
@@ -327,7 +326,8 @@ int ipath_make_ud_req(struct ipath_qp *qp)
                ohdr = &qp->s_hdr.u.oth;
        }
        if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) {
-               ohdr->u.ud.imm_data = wqe->wr.imm_data;
+               qp->s_hdrwords++;
+               ohdr->u.ud.imm_data = wqe->wr.ex.imm_data;
                bth0 = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE << 24;
        } else
                bth0 = IB_OPCODE_UD_SEND_ONLY << 24;
@@ -455,6 +455,28 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
                }
        }
 
+       /*
+        * The opcode is in the low byte when its in network order
+        * (top byte when in host order).
+        */
+       opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
+       if (qp->ibqp.qp_num > 1 &&
+           opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
+               if (header_in_data) {
+                       wc.imm_data = *(__be32 *) data;
+                       data += sizeof(__be32);
+               } else
+                       wc.imm_data = ohdr->u.ud.imm_data;
+               wc.wc_flags = IB_WC_WITH_IMM;
+               hdrsize += sizeof(u32);
+       } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
+               wc.imm_data = 0;
+               wc.wc_flags = 0;
+       } else {
+               dev->n_pkt_drops++;
+               goto bail;
+       }
+
        /* Get the number of bytes the message was padded by. */
        pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
        if (unlikely(tlen < (hdrsize + pad + 4))) {
@@ -481,28 +503,6 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
         */
        wc.byte_len = tlen + sizeof(struct ib_grh);
 
-       /*
-        * The opcode is in the low byte when its in network order
-        * (top byte when in host order).
-        */
-       opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
-       if (qp->ibqp.qp_num > 1 &&
-           opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
-               if (header_in_data) {
-                       wc.imm_data = *(__be32 *) data;
-                       data += sizeof(__be32);
-               } else
-                       wc.imm_data = ohdr->u.ud.imm_data;
-               wc.wc_flags = IB_WC_WITH_IMM;
-               hdrsize += sizeof(u32);
-       } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
-               wc.imm_data = 0;
-               wc.wc_flags = 0;
-       } else {
-               dev->n_pkt_drops++;
-               goto bail;
-       }
-
        /*
         * Get the next work request entry to find where to put the data.
         */