IB/qib: Remove driver specific members from qib qp type
[linux-2.6-microblaze.git] / drivers / infiniband / hw / qib / qib_ud.c
index 59193f6..682403a 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <rdma/ib_smi.h>
+#include <rdma/ib_verbs.h>
 
 #include "qib.h"
 #include "qib_mad.h"
@@ -234,6 +235,7 @@ drop:
  */
 int qib_make_ud_req(struct qib_qp *qp)
 {
+       struct qib_qp_priv *priv = qp->priv;
        struct qib_other_headers *ohdr;
        struct ib_ah_attr *ah_attr;
        struct qib_pportdata *ppd;
@@ -257,7 +259,7 @@ int qib_make_ud_req(struct qib_qp *qp)
                if (qp->s_last == qp->s_head)
                        goto bail;
                /* If DMAs are in progress, we can't flush immediately. */
-               if (atomic_read(&qp->s_dma_busy)) {
+               if (atomic_read(&priv->s_dma_busy)) {
                        qp->s_flags |= QIB_S_WAIT_DMA;
                        goto bail;
                }
@@ -278,8 +280,8 @@ int qib_make_ud_req(struct qib_qp *qp)
        ibp = to_iport(qp->ibqp.device, qp->port_num);
        ppd = ppd_from_ibp(ibp);
        ah_attr = &to_iah(wqe->ud_wr.ah)->attr;
-       if (ah_attr->dlid >= QIB_MULTICAST_LID_BASE) {
-               if (ah_attr->dlid != QIB_PERMISSIVE_LID)
+       if (ah_attr->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) {
+               if (ah_attr->dlid != be16_to_cpu(IB_LID_PERMISSIVE))
                        this_cpu_inc(ibp->pmastats->n_multicast_xmit);
                else
                        this_cpu_inc(ibp->pmastats->n_unicast_xmit);
@@ -294,7 +296,7 @@ int qib_make_ud_req(struct qib_qp *qp)
                         * XXX Instead of waiting, we could queue a
                         * zero length descriptor so we get a callback.
                         */
-                       if (atomic_read(&qp->s_dma_busy)) {
+                       if (atomic_read(&priv->s_dma_busy)) {
                                qp->s_flags |= QIB_S_WAIT_DMA;
                                goto bail;
                        }
@@ -324,11 +326,11 @@ int qib_make_ud_req(struct qib_qp *qp)
 
        if (ah_attr->ah_flags & IB_AH_GRH) {
                /* Header size in 32-bit words. */
-               qp->s_hdrwords += qib_make_grh(ibp, &qp->s_hdr->u.l.grh,
+               qp->s_hdrwords += qib_make_grh(ibp, &priv->s_hdr->u.l.grh,
                                               &ah_attr->grh,
                                               qp->s_hdrwords, nwords);
                lrh0 = QIB_LRH_GRH;
-               ohdr = &qp->s_hdr->u.l.oth;
+               ohdr = &priv->s_hdr->u.l.oth;
                /*
                 * Don't worry about sending to locally attached multicast
                 * QPs.  It is unspecified by the spec. what happens.
@@ -336,7 +338,7 @@ int qib_make_ud_req(struct qib_qp *qp)
        } else {
                /* Header size in 32-bit words. */
                lrh0 = QIB_LRH_BTH;
-               ohdr = &qp->s_hdr->u.oth;
+               ohdr = &priv->s_hdr->u.oth;
        }
        if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) {
                qp->s_hdrwords++;
@@ -349,15 +351,16 @@ int qib_make_ud_req(struct qib_qp *qp)
                lrh0 |= 0xF000; /* Set VL (see ch. 13.5.3.1) */
        else
                lrh0 |= ibp->sl_to_vl[ah_attr->sl] << 12;
-       qp->s_hdr->lrh[0] = cpu_to_be16(lrh0);
-       qp->s_hdr->lrh[1] = cpu_to_be16(ah_attr->dlid);  /* DEST LID */
-       qp->s_hdr->lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords + SIZE_OF_CRC);
+       priv->s_hdr->lrh[0] = cpu_to_be16(lrh0);
+       priv->s_hdr->lrh[1] = cpu_to_be16(ah_attr->dlid);  /* DEST LID */
+       priv->s_hdr->lrh[2] =
+                       cpu_to_be16(qp->s_hdrwords + nwords + SIZE_OF_CRC);
        lid = ppd->lid;
        if (lid) {
                lid |= ah_attr->src_path_bits & ((1 << ppd->lmc) - 1);
-               qp->s_hdr->lrh[3] = cpu_to_be16(lid);
+               priv->s_hdr->lrh[3] = cpu_to_be16(lid);
        } else
-               qp->s_hdr->lrh[3] = IB_LID_PERMISSIVE;
+               priv->s_hdr->lrh[3] = IB_LID_PERMISSIVE;
        if (wqe->wr.send_flags & IB_SEND_SOLICITED)
                bth0 |= IB_BTH_SOLICITED;
        bth0 |= extra_bytes << 20;
@@ -368,8 +371,8 @@ int qib_make_ud_req(struct qib_qp *qp)
        /*
         * Use the multicast QP if the destination LID is a multicast LID.
         */
-       ohdr->bth[1] = ah_attr->dlid >= QIB_MULTICAST_LID_BASE &&
-               ah_attr->dlid != QIB_PERMISSIVE_LID ?
+       ohdr->bth[1] = ah_attr->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) &&
+               ah_attr->dlid != be16_to_cpu(IB_LID_PERMISSIVE) ?
                cpu_to_be32(QIB_MULTICAST_QPN) :
                cpu_to_be32(wqe->ud_wr.remote_qpn);
        ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & QIB_PSN_MASK);
@@ -576,7 +579,7 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
        /*
         * Save the LMC lower bits if the destination LID is a unicast LID.
         */
-       wc.dlid_path_bits = dlid >= QIB_MULTICAST_LID_BASE ? 0 :
+       wc.dlid_path_bits = dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) ? 0 :
                dlid & ((1 << ppd_from_ibp(ibp)->lmc) - 1);
        wc.port_num = qp->port_num;
        /* Signal completion event if the solicited bit is set. */