staging/rdma/hfi1: Use rdmavt send flags and recv flags
[cascardo/linux.git] / drivers / staging / rdma / hfi1 / rc.c
index 6f4a155..bd504de 100644 (file)
@@ -60,7 +60,7 @@
 
 static void rc_timeout(unsigned long arg);
 
-static u32 restart_sge(struct hfi1_sge_state *ss, struct hfi1_swqe *wqe,
+static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe,
                       u32 psn, u32 pmtu)
 {
        u32 len;
@@ -74,9 +74,9 @@ static u32 restart_sge(struct hfi1_sge_state *ss, struct hfi1_swqe *wqe,
        return wqe->length - len;
 }
 
-static void start_timer(struct hfi1_qp *qp)
+static void start_timer(struct rvt_qp *qp)
 {
-       qp->s_flags |= HFI1_S_TIMER;
+       qp->s_flags |= RVT_S_TIMER;
        qp->s_timer.function = rc_timeout;
        /* 4.096 usec. * (1 << qp->timeout) */
        qp->s_timer.expires = jiffies + qp->timeout_jiffies;
@@ -94,10 +94,10 @@ static void start_timer(struct hfi1_qp *qp)
  * Note that we are in the responder's side of the QP context.
  * Note the QP s_lock must be held.
  */
-static int make_rc_ack(struct hfi1_ibdev *dev, struct hfi1_qp *qp,
+static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,
                       struct hfi1_other_headers *ohdr, u32 pmtu)
 {
-       struct hfi1_ack_entry *e;
+       struct rvt_ack_entry *e;
        u32 hwords;
        u32 len;
        u32 bth0;
@@ -116,7 +116,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct hfi1_qp *qp,
        case OP(RDMA_READ_RESPONSE_ONLY):
                e = &qp->s_ack_queue[qp->s_tail_ack_queue];
                if (e->rdma_sge.mr) {
-                       hfi1_put_mr(e->rdma_sge.mr);
+                       rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
                /* FALLTHROUGH */
@@ -133,7 +133,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct hfi1_qp *qp,
        case OP(ACKNOWLEDGE):
                /* Check for no next entry in the queue. */
                if (qp->r_head_ack_queue == qp->s_tail_ack_queue) {
-                       if (qp->s_flags & HFI1_S_ACK_PENDING)
+                       if (qp->s_flags & RVT_S_ACK_PENDING)
                                goto normal;
                        goto bail;
                }
@@ -154,7 +154,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct hfi1_qp *qp,
                        /* Copy SGE state in case we need to resend */
                        qp->s_rdma_mr = e->rdma_sge.mr;
                        if (qp->s_rdma_mr)
-                               hfi1_get_mr(qp->s_rdma_mr);
+                               rvt_get_mr(qp->s_rdma_mr);
                        qp->s_ack_rdma_sge.sge = e->rdma_sge;
                        qp->s_ack_rdma_sge.num_sge = 1;
                        qp->s_cur_sge = &qp->s_ack_rdma_sge;
@@ -193,7 +193,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct hfi1_qp *qp,
                qp->s_cur_sge = &qp->s_ack_rdma_sge;
                qp->s_rdma_mr = qp->s_ack_rdma_sge.sge.mr;
                if (qp->s_rdma_mr)
-                       hfi1_get_mr(qp->s_rdma_mr);
+                       rvt_get_mr(qp->s_rdma_mr);
                len = qp->s_ack_rdma_sge.sge.sge_length;
                if (len > pmtu) {
                        len = pmtu;
@@ -218,7 +218,7 @@ normal:
                 * (see above).
                 */
                qp->s_ack_state = OP(SEND_ONLY);
-               qp->s_flags &= ~HFI1_S_ACK_PENDING;
+               qp->s_flags &= ~RVT_S_ACK_PENDING;
                qp->s_cur_sge = NULL;
                if (qp->s_nak_state)
                        ohdr->u.aeth =
@@ -242,12 +242,12 @@ bail:
        qp->s_ack_state = OP(ACKNOWLEDGE);
        /*
         * Ensure s_rdma_ack_cnt changes are committed prior to resetting
-        * HFI1_S_RESP_PENDING
+        * RVT_S_RESP_PENDING
         */
        smp_wmb();
-       qp->s_flags &= ~(HFI1_S_RESP_PENDING
-                               | HFI1_S_ACK_PENDING
-                               | HFI1_S_AHG_VALID);
+       qp->s_flags &= ~(RVT_S_RESP_PENDING
+                               | RVT_S_ACK_PENDING
+                               | RVT_S_AHG_VALID);
        return 0;
 }
 
@@ -257,12 +257,13 @@ bail:
  *
  * Return 1 if constructed; otherwise, return 0.
  */
-int hfi1_make_rc_req(struct hfi1_qp *qp)
+int hfi1_make_rc_req(struct rvt_qp *qp)
 {
+       struct hfi1_qp_priv *priv = qp->priv;
        struct hfi1_ibdev *dev = to_idev(qp->ibqp.device);
        struct hfi1_other_headers *ohdr;
-       struct hfi1_sge_state *ss;
-       struct hfi1_swqe *wqe;
+       struct rvt_sge_state *ss;
+       struct rvt_swqe *wqe;
        /* header size in 32-bit words LRH+BTH = (8+12)/4. */
        u32 hwords = 5;
        u32 len;
@@ -275,9 +276,9 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
        int middle = 0;
        int delta;
 
-       ohdr = &qp->s_hdr->ibh.u.oth;
+       ohdr = &priv->s_hdr->ibh.u.oth;
        if (qp->remote_ah_attr.ah_flags & IB_AH_GRH)
-               ohdr = &qp->s_hdr->ibh.u.l.oth;
+               ohdr = &priv->s_hdr->ibh.u.l.oth;
 
        /*
         * The lock is needed to synchronize between the sending tasklet,
@@ -286,7 +287,7 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
        spin_lock_irqsave(&qp->s_lock, flags);
 
        /* Sending responses has higher priority over sending requests. */
-       if ((qp->s_flags & HFI1_S_RESP_PENDING) &&
+       if ((qp->s_flags & RVT_S_RESP_PENDING) &&
            make_rc_ack(dev, qp, ohdr, pmtu))
                goto done;
 
@@ -297,8 +298,8 @@ int hfi1_make_rc_req(struct hfi1_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_iowait.sdma_busy)) {
-                       qp->s_flags |= HFI1_S_WAIT_DMA;
+               if (atomic_read(&priv->s_iowait.sdma_busy)) {
+                       qp->s_flags |= RVT_S_WAIT_DMA;
                        goto bail;
                }
                clear_ahg(qp);
@@ -309,12 +310,12 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                goto done;
        }
 
-       if (qp->s_flags & (HFI1_S_WAIT_RNR | HFI1_S_WAIT_ACK))
+       if (qp->s_flags & (RVT_S_WAIT_RNR | RVT_S_WAIT_ACK))
                goto bail;
 
        if (cmp_psn(qp->s_psn, qp->s_sending_hpsn) <= 0) {
                if (cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0) {
-                       qp->s_flags |= HFI1_S_WAIT_PSN;
+                       qp->s_flags |= RVT_S_WAIT_PSN;
                        goto bail;
                }
                qp->s_sending_psn = qp->s_psn;
@@ -347,7 +348,7 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                         */
                        if ((wqe->wr.send_flags & IB_SEND_FENCE) &&
                            qp->s_num_rd_atomic) {
-                               qp->s_flags |= HFI1_S_WAIT_FENCE;
+                               qp->s_flags |= RVT_S_WAIT_FENCE;
                                goto bail;
                        }
                        wqe->psn = qp->s_next_psn;
@@ -365,9 +366,9 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                case IB_WR_SEND:
                case IB_WR_SEND_WITH_IMM:
                        /* If no credit, return. */
-                       if (!(qp->s_flags & HFI1_S_UNLIMITED_CREDIT) &&
+                       if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) &&
                            cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
-                               qp->s_flags |= HFI1_S_WAIT_SSN_CREDIT;
+                               qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
                                goto bail;
                        }
                        wqe->lpsn = wqe->psn;
@@ -393,14 +394,14 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                        break;
 
                case IB_WR_RDMA_WRITE:
-                       if (newreq && !(qp->s_flags & HFI1_S_UNLIMITED_CREDIT))
+                       if (newreq && !(qp->s_flags & RVT_S_UNLIMITED_CREDIT))
                                qp->s_lsn++;
                        /* FALLTHROUGH */
                case IB_WR_RDMA_WRITE_WITH_IMM:
                        /* If no credit, return. */
-                       if (!(qp->s_flags & HFI1_S_UNLIMITED_CREDIT) &&
+                       if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) &&
                            cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
-                               qp->s_flags |= HFI1_S_WAIT_SSN_CREDIT;
+                               qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
                                goto bail;
                        }
                        ohdr->u.rc.reth.vaddr =
@@ -440,11 +441,11 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                        if (newreq) {
                                if (qp->s_num_rd_atomic >=
                                    qp->s_max_rd_atomic) {
-                                       qp->s_flags |= HFI1_S_WAIT_RDMAR;
+                                       qp->s_flags |= RVT_S_WAIT_RDMAR;
                                        goto bail;
                                }
                                qp->s_num_rd_atomic++;
-                               if (!(qp->s_flags & HFI1_S_UNLIMITED_CREDIT))
+                               if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT))
                                        qp->s_lsn++;
                                /*
                                 * Adjust s_next_psn to count the
@@ -477,11 +478,11 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
                        if (newreq) {
                                if (qp->s_num_rd_atomic >=
                                    qp->s_max_rd_atomic) {
-                                       qp->s_flags |= HFI1_S_WAIT_RDMAR;
+                                       qp->s_flags |= RVT_S_WAIT_RDMAR;
                                        goto bail;
                                }
                                qp->s_num_rd_atomic++;
-                               if (!(qp->s_flags & HFI1_S_UNLIMITED_CREDIT))
+                               if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT))
                                        qp->s_lsn++;
                                wqe->lpsn = wqe->psn;
                        }
@@ -648,9 +649,9 @@ int hfi1_make_rc_req(struct hfi1_qp *qp)
        delta = delta_psn(bth2, wqe->psn);
        if (delta && delta % HFI1_PSN_CREDIT == 0)
                bth2 |= IB_BTH_REQ_ACK;
-       if (qp->s_flags & HFI1_S_SEND_ONE) {
-               qp->s_flags &= ~HFI1_S_SEND_ONE;
-               qp->s_flags |= HFI1_S_WAIT_ACK;
+       if (qp->s_flags & RVT_S_SEND_ONE) {
+               qp->s_flags &= ~RVT_S_SEND_ONE;
+               qp->s_flags |= RVT_S_WAIT_ACK;
                bth2 |= IB_BTH_REQ_ACK;
        }
        qp->s_len -= len;
@@ -668,7 +669,7 @@ done:
        goto unlock;
 
 bail:
-       qp->s_flags &= ~HFI1_S_BUSY;
+       qp->s_flags &= ~RVT_S_BUSY;
 unlock:
        spin_unlock_irqrestore(&qp->s_lock, flags);
        return ret;
@@ -682,7 +683,7 @@ unlock:
  * Note that RDMA reads and atomics are handled in the
  * send side QP state and tasklet.
  */
-void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct hfi1_qp *qp,
+void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
                      int is_fecn)
 {
        struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
@@ -700,7 +701,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct hfi1_qp *qp,
        unsigned long flags;
 
        /* Don't send ACK or NAK if a RDMA read or atomic is pending. */
-       if (qp->s_flags & HFI1_S_RESP_PENDING)
+       if (qp->s_flags & RVT_S_RESP_PENDING)
                goto queue_ack;
 
        /* Ensure s_rdma_ack_cnt changes are committed */
@@ -771,13 +772,13 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct hfi1_qp *qp,
        return;
 
 queue_ack:
-       this_cpu_inc(*ibp->rc_qacks);
+       this_cpu_inc(*ibp->rvp.rc_qacks);
        spin_lock_irqsave(&qp->s_lock, flags);
-       qp->s_flags |= HFI1_S_ACK_PENDING | HFI1_S_RESP_PENDING;
+       qp->s_flags |= RVT_S_ACK_PENDING | RVT_S_RESP_PENDING;
        qp->s_nak_state = qp->r_nak_state;
        qp->s_ack_psn = qp->r_ack_psn;
        if (is_fecn)
-               qp->s_flags |= HFI1_S_ECN;
+               qp->s_flags |= RVT_S_ECN;
 
        /* Schedule the send tasklet. */
        hfi1_schedule_send(qp);
@@ -793,10 +794,10 @@ queue_ack:
  * for the given QP.
  * Called at interrupt level with the QP s_lock held.
  */
-static void reset_psn(struct hfi1_qp *qp, u32 psn)
+static void reset_psn(struct rvt_qp *qp, u32 psn)
 {
        u32 n = qp->s_acked;
-       struct hfi1_swqe *wqe = get_swqe_ptr(qp, n);
+       struct rvt_swqe *wqe = get_swqe_ptr(qp, n);
        u32 opcode;
 
        qp->s_cur = n;
@@ -865,23 +866,23 @@ static void reset_psn(struct hfi1_qp *qp, u32 psn)
 done:
        qp->s_psn = psn;
        /*
-        * Set HFI1_S_WAIT_PSN as rc_complete() may start the timer
+        * Set RVT_S_WAIT_PSN as rc_complete() may start the timer
         * asynchronously before the send tasklet can get scheduled.
         * Doing it in hfi1_make_rc_req() is too late.
         */
        if ((cmp_psn(qp->s_psn, qp->s_sending_hpsn) <= 0) &&
            (cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0))
-               qp->s_flags |= HFI1_S_WAIT_PSN;
-       qp->s_flags &= ~HFI1_S_AHG_VALID;
+               qp->s_flags |= RVT_S_WAIT_PSN;
+       qp->s_flags &= ~RVT_S_AHG_VALID;
 }
 
 /*
  * Back up requester to resend the last un-ACKed request.
  * The QP r_lock and s_lock should be held and interrupts disabled.
  */
-static void restart_rc(struct hfi1_qp *qp, u32 psn, int wait)
+static void restart_rc(struct rvt_qp *qp, u32 psn, int wait)
 {
-       struct hfi1_swqe *wqe = get_swqe_ptr(qp, qp->s_acked);
+       struct rvt_swqe *wqe = get_swqe_ptr(qp, qp->s_acked);
        struct hfi1_ibport *ibp;
 
        if (qp->s_retry == 0) {
@@ -899,15 +900,15 @@ static void restart_rc(struct hfi1_qp *qp, u32 psn, int wait)
 
        ibp = to_iport(qp->ibqp.device, qp->port_num);
        if (wqe->wr.opcode == IB_WR_RDMA_READ)
-               ibp->n_rc_resends++;
+               ibp->rvp.n_rc_resends++;
        else
-               ibp->n_rc_resends += delta_psn(qp->s_psn, psn);
+               ibp->rvp.n_rc_resends += delta_psn(qp->s_psn, psn);
 
-       qp->s_flags &= ~(HFI1_S_WAIT_FENCE | HFI1_S_WAIT_RDMAR |
-                        HFI1_S_WAIT_SSN_CREDIT | HFI1_S_WAIT_PSN |
-                        HFI1_S_WAIT_ACK);
+       qp->s_flags &= ~(RVT_S_WAIT_FENCE | RVT_S_WAIT_RDMAR |
+                        RVT_S_WAIT_SSN_CREDIT | RVT_S_WAIT_PSN |
+                        RVT_S_WAIT_ACK);
        if (wait)
-               qp->s_flags |= HFI1_S_SEND_ONE;
+               qp->s_flags |= RVT_S_SEND_ONE;
        reset_psn(qp, psn);
 }
 
@@ -916,16 +917,16 @@ static void restart_rc(struct hfi1_qp *qp, u32 psn, int wait)
  */
 static void rc_timeout(unsigned long arg)
 {
-       struct hfi1_qp *qp = (struct hfi1_qp *)arg;
+       struct rvt_qp *qp = (struct rvt_qp *)arg;
        struct hfi1_ibport *ibp;
        unsigned long flags;
 
        spin_lock_irqsave(&qp->r_lock, flags);
        spin_lock(&qp->s_lock);
-       if (qp->s_flags & HFI1_S_TIMER) {
+       if (qp->s_flags & RVT_S_TIMER) {
                ibp = to_iport(qp->ibqp.device, qp->port_num);
-               ibp->n_rc_timeouts++;
-               qp->s_flags &= ~HFI1_S_TIMER;
+               ibp->rvp.n_rc_timeouts++;
+               qp->s_flags &= ~RVT_S_TIMER;
                del_timer(&qp->s_timer);
                trace_hfi1_rc_timeout(qp, qp->s_last_psn + 1);
                restart_rc(qp, qp->s_last_psn + 1, 1);
@@ -940,12 +941,12 @@ static void rc_timeout(unsigned long arg)
  */
 void hfi1_rc_rnr_retry(unsigned long arg)
 {
-       struct hfi1_qp *qp = (struct hfi1_qp *)arg;
+       struct rvt_qp *qp = (struct rvt_qp *)arg;
        unsigned long flags;
 
        spin_lock_irqsave(&qp->s_lock, flags);
-       if (qp->s_flags & HFI1_S_WAIT_RNR) {
-               qp->s_flags &= ~HFI1_S_WAIT_RNR;
+       if (qp->s_flags & RVT_S_WAIT_RNR) {
+               qp->s_flags &= ~RVT_S_WAIT_RNR;
                del_timer(&qp->s_timer);
                hfi1_schedule_send(qp);
        }
@@ -956,9 +957,9 @@ void hfi1_rc_rnr_retry(unsigned long arg)
  * Set qp->s_sending_psn to the next PSN after the given one.
  * This would be psn+1 except when RDMA reads are present.
  */
-static void reset_sending_psn(struct hfi1_qp *qp, u32 psn)
+static void reset_sending_psn(struct rvt_qp *qp, u32 psn)
 {
-       struct hfi1_swqe *wqe;
+       struct rvt_swqe *wqe;
        u32 n = qp->s_last;
 
        /* Find the work request corresponding to the given PSN. */
@@ -981,10 +982,10 @@ static void reset_sending_psn(struct hfi1_qp *qp, u32 psn)
 /*
  * This should be called with the QP s_lock held and interrupts disabled.
  */
-void hfi1_rc_send_complete(struct hfi1_qp *qp, struct hfi1_ib_header *hdr)
+void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr)
 {
        struct hfi1_other_headers *ohdr;
-       struct hfi1_swqe *wqe;
+       struct rvt_swqe *wqe;
        struct ib_wc wc;
        unsigned i;
        u32 opcode;
@@ -1016,7 +1017,7 @@ void hfi1_rc_send_complete(struct hfi1_qp *qp, struct hfi1_ib_header *hdr)
         */
        if ((psn & IB_BTH_REQ_ACK) && qp->s_acked != qp->s_tail &&
            !(qp->s_flags &
-               (HFI1_S_TIMER | HFI1_S_WAIT_RNR | HFI1_S_WAIT_PSN)) &&
+               (RVT_S_TIMER | RVT_S_WAIT_RNR | RVT_S_WAIT_PSN)) &&
                (ib_hfi1_state_ops[qp->state] & HFI1_PROCESS_RECV_OK))
                start_timer(qp);
 
@@ -1026,12 +1027,12 @@ void hfi1_rc_send_complete(struct hfi1_qp *qp, struct hfi1_ib_header *hdr)
                    cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0)
                        break;
                for (i = 0; i < wqe->wr.num_sge; i++) {
-                       struct hfi1_sge *sge = &wqe->sg_list[i];
+                       struct rvt_sge *sge = &wqe->sg_list[i];
 
-                       hfi1_put_mr(sge->mr);
+                       rvt_put_mr(sge->mr);
                }
                /* Post a send completion queue entry if requested. */
-               if (!(qp->s_flags & HFI1_S_SIGNAL_REQ_WR) ||
+               if (!(qp->s_flags & RVT_S_SIGNAL_REQ_WR) ||
                    (wqe->wr.send_flags & IB_SEND_SIGNALED)) {
                        memset(&wc, 0, sizeof(wc));
                        wc.wr_id = wqe->wr.wr_id;
@@ -1049,16 +1050,16 @@ void hfi1_rc_send_complete(struct hfi1_qp *qp, struct hfi1_ib_header *hdr)
         * and they are now complete, restart sending.
         */
        trace_hfi1_rc_sendcomplete(qp, psn);
-       if (qp->s_flags & HFI1_S_WAIT_PSN &&
+       if (qp->s_flags & RVT_S_WAIT_PSN &&
            cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) > 0) {
-               qp->s_flags &= ~HFI1_S_WAIT_PSN;
+               qp->s_flags &= ~RVT_S_WAIT_PSN;
                qp->s_sending_psn = qp->s_psn;
                qp->s_sending_hpsn = qp->s_psn - 1;
                hfi1_schedule_send(qp);
        }
 }
 
-static inline void update_last_psn(struct hfi1_qp *qp, u32 psn)
+static inline void update_last_psn(struct rvt_qp *qp, u32 psn)
 {
        qp->s_last_psn = psn;
 }
@@ -1068,9 +1069,9 @@ static inline void update_last_psn(struct hfi1_qp *qp, u32 psn)
  * This is similar to hfi1_send_complete but has to check to be sure
  * that the SGEs are not being referenced if the SWQE is being resent.
  */
-static struct hfi1_swqe *do_rc_completion(struct hfi1_qp *qp,
-                                         struct hfi1_swqe *wqe,
-                                         struct hfi1_ibport *ibp)
+static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,
+                                        struct rvt_swqe *wqe,
+                                        struct hfi1_ibport *ibp)
 {
        struct ib_wc wc;
        unsigned i;
@@ -1083,12 +1084,12 @@ static struct hfi1_swqe *do_rc_completion(struct hfi1_qp *qp,
        if (cmp_psn(wqe->lpsn, qp->s_sending_psn) < 0 ||
            cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) > 0) {
                for (i = 0; i < wqe->wr.num_sge; i++) {
-                       struct hfi1_sge *sge = &wqe->sg_list[i];
+                       struct rvt_sge *sge = &wqe->sg_list[i];
 
-                       hfi1_put_mr(sge->mr);
+                       rvt_put_mr(sge->mr);
                }
                /* Post a send completion queue entry if requested. */
-               if (!(qp->s_flags & HFI1_S_SIGNAL_REQ_WR) ||
+               if (!(qp->s_flags & RVT_S_SIGNAL_REQ_WR) ||
                    (wqe->wr.send_flags & IB_SEND_SIGNALED)) {
                        memset(&wc, 0, sizeof(wc));
                        wc.wr_id = wqe->wr.wr_id;
@@ -1103,7 +1104,7 @@ static struct hfi1_swqe *do_rc_completion(struct hfi1_qp *qp,
        } else {
                struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
 
-               this_cpu_inc(*ibp->rc_delayed_comp);
+               this_cpu_inc(*ibp->rvp.rc_delayed_comp);
                /*
                 * If send progress not running attempt to progress
                 * SDMA queue.
@@ -1157,19 +1158,19 @@ static struct hfi1_swqe *do_rc_completion(struct hfi1_qp *qp,
  * May be called at interrupt level, with the QP s_lock held.
  * Returns 1 if OK, 0 if current operation should be aborted (NAK).
  */
-static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
+static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
                     u64 val, struct hfi1_ctxtdata *rcd)
 {
        struct hfi1_ibport *ibp;
        enum ib_wc_status status;
-       struct hfi1_swqe *wqe;
+       struct rvt_swqe *wqe;
        int ret = 0;
        u32 ack_psn;
        int diff;
 
        /* Remove QP from retry timer */
-       if (qp->s_flags & (HFI1_S_TIMER | HFI1_S_WAIT_RNR)) {
-               qp->s_flags &= ~(HFI1_S_TIMER | HFI1_S_WAIT_RNR);
+       if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) {
+               qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR);
                del_timer(&qp->s_timer);
        }
 
@@ -1217,11 +1218,11 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                      wqe->wr.opcode == IB_WR_ATOMIC_FETCH_AND_ADD) &&
                     (opcode != OP(ATOMIC_ACKNOWLEDGE) || diff != 0))) {
                        /* Retry this request. */
-                       if (!(qp->r_flags & HFI1_R_RDMAR_SEQ)) {
-                               qp->r_flags |= HFI1_R_RDMAR_SEQ;
+                       if (!(qp->r_flags & RVT_R_RDMAR_SEQ)) {
+                               qp->r_flags |= RVT_R_RDMAR_SEQ;
                                restart_rc(qp, qp->s_last_psn + 1, 0);
                                if (list_empty(&qp->rspwait)) {
-                                       qp->r_flags |= HFI1_R_RSP_SEND;
+                                       qp->r_flags |= RVT_R_RSP_SEND;
                                        atomic_inc(&qp->refcount);
                                        list_add_tail(&qp->rspwait,
                                                      &rcd->qp_wait_list);
@@ -1244,14 +1245,14 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                     wqe->wr.opcode == IB_WR_ATOMIC_FETCH_AND_ADD)) {
                        qp->s_num_rd_atomic--;
                        /* Restart sending task if fence is complete */
-                       if ((qp->s_flags & HFI1_S_WAIT_FENCE) &&
+                       if ((qp->s_flags & RVT_S_WAIT_FENCE) &&
                            !qp->s_num_rd_atomic) {
-                               qp->s_flags &= ~(HFI1_S_WAIT_FENCE |
-                                                HFI1_S_WAIT_ACK);
+                               qp->s_flags &= ~(RVT_S_WAIT_FENCE |
+                                                RVT_S_WAIT_ACK);
                                hfi1_schedule_send(qp);
-                       } else if (qp->s_flags & HFI1_S_WAIT_RDMAR) {
-                               qp->s_flags &= ~(HFI1_S_WAIT_RDMAR |
-                                                HFI1_S_WAIT_ACK);
+                       } else if (qp->s_flags & RVT_S_WAIT_RDMAR) {
+                               qp->s_flags &= ~(RVT_S_WAIT_RDMAR |
+                                                RVT_S_WAIT_ACK);
                                hfi1_schedule_send(qp);
                        }
                }
@@ -1262,7 +1263,7 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
 
        switch (aeth >> 29) {
        case 0:         /* ACK */
-               this_cpu_inc(*ibp->rc_acks);
+               this_cpu_inc(*ibp->rvp.rc_acks);
                if (qp->s_acked != qp->s_tail) {
                        /*
                         * We are expecting more ACKs so
@@ -1279,8 +1280,8 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                        qp->s_state = OP(SEND_LAST);
                        qp->s_psn = psn + 1;
                }
-               if (qp->s_flags & HFI1_S_WAIT_ACK) {
-                       qp->s_flags &= ~HFI1_S_WAIT_ACK;
+               if (qp->s_flags & RVT_S_WAIT_ACK) {
+                       qp->s_flags &= ~RVT_S_WAIT_ACK;
                        hfi1_schedule_send(qp);
                }
                hfi1_get_credit(qp, aeth);
@@ -1291,10 +1292,10 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                goto bail;
 
        case 1:         /* RNR NAK */
-               ibp->n_rnr_naks++;
+               ibp->rvp.n_rnr_naks++;
                if (qp->s_acked == qp->s_tail)
                        goto bail;
-               if (qp->s_flags & HFI1_S_WAIT_RNR)
+               if (qp->s_flags & RVT_S_WAIT_RNR)
                        goto bail;
                if (qp->s_rnr_retry == 0) {
                        status = IB_WC_RNR_RETRY_EXC_ERR;
@@ -1306,12 +1307,12 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                /* The last valid PSN is the previous PSN. */
                update_last_psn(qp, psn - 1);
 
-               ibp->n_rc_resends += delta_psn(qp->s_psn, psn);
+               ibp->rvp.n_rc_resends += delta_psn(qp->s_psn, psn);
 
                reset_psn(qp, psn);
 
-               qp->s_flags &= ~(HFI1_S_WAIT_SSN_CREDIT | HFI1_S_WAIT_ACK);
-               qp->s_flags |= HFI1_S_WAIT_RNR;
+               qp->s_flags &= ~(RVT_S_WAIT_SSN_CREDIT | RVT_S_WAIT_ACK);
+               qp->s_flags |= RVT_S_WAIT_RNR;
                qp->s_timer.function = hfi1_rc_rnr_retry;
                qp->s_timer.expires = jiffies + usecs_to_jiffies(
                        ib_hfi1_rnr_table[(aeth >> HFI1_AETH_CREDIT_SHIFT) &
@@ -1327,7 +1328,7 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
                switch ((aeth >> HFI1_AETH_CREDIT_SHIFT) &
                        HFI1_AETH_CREDIT_MASK) {
                case 0: /* PSN sequence error */
-                       ibp->n_seq_naks++;
+                       ibp->rvp.n_seq_naks++;
                        /*
                         * Back up to the responder's expected PSN.
                         * Note that we might get a NAK in the middle of an
@@ -1340,17 +1341,17 @@ static int do_rc_ack(struct hfi1_qp *qp, u32 aeth, u32 psn, int opcode,
 
                case 1: /* Invalid Request */
                        status = IB_WC_REM_INV_REQ_ERR;
-                       ibp->n_other_naks++;
+                       ibp->rvp.n_other_naks++;
                        goto class_b;
 
                case 2: /* Remote Access Error */
                        status = IB_WC_REM_ACCESS_ERR;
-                       ibp->n_other_naks++;
+                       ibp->rvp.n_other_naks++;
                        goto class_b;
 
                case 3: /* Remote Operation Error */
                        status = IB_WC_REM_OP_ERR;
-                       ibp->n_other_naks++;
+                       ibp->rvp.n_other_naks++;
 class_b:
                        if (qp->s_last == qp->s_acked) {
                                hfi1_send_complete(qp, wqe, status);
@@ -1380,14 +1381,14 @@ bail:
  * We have seen an out of sequence RDMA read middle or last packet.
  * This ACKs SENDs and RDMA writes up to the first RDMA read or atomic SWQE.
  */
-static void rdma_seq_err(struct hfi1_qp *qp, struct hfi1_ibport *ibp, u32 psn,
+static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn,
                         struct hfi1_ctxtdata *rcd)
 {
-       struct hfi1_swqe *wqe;
+       struct rvt_swqe *wqe;
 
        /* Remove QP from retry timer */
-       if (qp->s_flags & (HFI1_S_TIMER | HFI1_S_WAIT_RNR)) {
-               qp->s_flags &= ~(HFI1_S_TIMER | HFI1_S_WAIT_RNR);
+       if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) {
+               qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR);
                del_timer(&qp->s_timer);
        }
 
@@ -1401,11 +1402,11 @@ static void rdma_seq_err(struct hfi1_qp *qp, struct hfi1_ibport *ibp, u32 psn,
                wqe = do_rc_completion(qp, wqe, ibp);
        }
 
-       ibp->n_rdma_seq++;
-       qp->r_flags |= HFI1_R_RDMAR_SEQ;
+       ibp->rvp.n_rdma_seq++;
+       qp->r_flags |= RVT_R_RDMAR_SEQ;
        restart_rc(qp, qp->s_last_psn + 1, 0);
        if (list_empty(&qp->rspwait)) {
-               qp->r_flags |= HFI1_R_RSP_SEND;
+               qp->r_flags |= RVT_R_RSP_SEND;
                atomic_inc(&qp->refcount);
                list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
        }
@@ -1429,11 +1430,11 @@ static void rdma_seq_err(struct hfi1_qp *qp, struct hfi1_ibport *ibp, u32 psn,
  */
 static void rc_rcv_resp(struct hfi1_ibport *ibp,
                        struct hfi1_other_headers *ohdr,
-                       void *data, u32 tlen, struct hfi1_qp *qp,
+                       void *data, u32 tlen, struct rvt_qp *qp,
                        u32 opcode, u32 psn, u32 hdrsize, u32 pmtu,
                        struct hfi1_ctxtdata *rcd)
 {
-       struct hfi1_swqe *wqe;
+       struct rvt_swqe *wqe;
        enum ib_wc_status status;
        unsigned long flags;
        int diff;
@@ -1465,10 +1466,10 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,
         * Skip everything other than the PSN we expect, if we are waiting
         * for a reply to a restarted RDMA read or atomic op.
         */
-       if (qp->r_flags & HFI1_R_RDMAR_SEQ) {
+       if (qp->r_flags & RVT_R_RDMAR_SEQ) {
                if (cmp_psn(psn, qp->s_last_psn + 1) != 0)
                        goto ack_done;
-               qp->r_flags &= ~HFI1_R_RDMAR_SEQ;
+               qp->r_flags &= ~RVT_R_RDMAR_SEQ;
        }
 
        if (unlikely(qp->s_acked == qp->s_tail))
@@ -1519,10 +1520,10 @@ read_middle:
                 * We got a response so update the timeout.
                 * 4.096 usec. * (1 << qp->timeout)
                 */
-               qp->s_flags |= HFI1_S_TIMER;
+               qp->s_flags |= RVT_S_TIMER;
                mod_timer(&qp->s_timer, jiffies + qp->timeout_jiffies);
-               if (qp->s_flags & HFI1_S_WAIT_ACK) {
-                       qp->s_flags &= ~HFI1_S_WAIT_ACK;
+               if (qp->s_flags & RVT_S_WAIT_ACK) {
+                       qp->s_flags &= ~RVT_S_WAIT_ACK;
                        hfi1_schedule_send(qp);
                }
 
@@ -1609,22 +1610,24 @@ bail:
 }
 
 static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd,
-                                 struct hfi1_qp *qp)
+                                 struct rvt_qp *qp)
 {
        if (list_empty(&qp->rspwait)) {
-               qp->r_flags |= HFI1_R_RSP_DEFERED_ACK;
+               qp->r_flags |= RVT_R_RSP_NAK;
                atomic_inc(&qp->refcount);
                list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
        }
 }
 
-static inline void rc_cancel_ack(struct hfi1_qp *qp)
+static inline void rc_cancel_ack(struct rvt_qp *qp)
 {
-       qp->r_adefered = 0;
+       struct hfi1_qp_priv *priv = qp->priv;
+
+       priv->r_adefered = 0;
        if (list_empty(&qp->rspwait))
                return;
        list_del_init(&qp->rspwait);
-       qp->r_flags &= ~HFI1_R_RSP_DEFERED_ACK;
+       qp->r_flags &= ~RVT_R_RSP_NAK;
        if (atomic_dec_and_test(&qp->refcount))
                wake_up(&qp->wait);
 }
@@ -1645,11 +1648,11 @@ static inline void rc_cancel_ack(struct hfi1_qp *qp)
  * schedule a response to be sent.
  */
 static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
-                       struct hfi1_qp *qp, u32 opcode, u32 psn, int diff,
+                       struct rvt_qp *qp, u32 opcode, u32 psn, int diff,
                        struct hfi1_ctxtdata *rcd)
 {
        struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
-       struct hfi1_ack_entry *e;
+       struct rvt_ack_entry *e;
        unsigned long flags;
        u8 i, prev;
        int old_req;
@@ -1662,7 +1665,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
                 * Don't queue the NAK if we already sent one.
                 */
                if (!qp->r_nak_state) {
-                       ibp->n_rc_seqnak++;
+                       ibp->rvp.n_rc_seqnak++;
                        qp->r_nak_state = IB_NAK_PSN_ERROR;
                        /* Use the expected PSN. */
                        qp->r_ack_psn = qp->r_psn;
@@ -1694,7 +1697,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
         */
        e = NULL;
        old_req = 1;
-       ibp->n_rc_dupreq++;
+       ibp->rvp.n_rc_dupreq++;
 
        spin_lock_irqsave(&qp->s_lock, flags);
 
@@ -1747,7 +1750,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
                if (unlikely(offset + len != e->rdma_sge.sge_length))
                        goto unlock_done;
                if (e->rdma_sge.mr) {
-                       hfi1_put_mr(e->rdma_sge.mr);
+                       rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
                if (len != 0) {
@@ -1755,8 +1758,8 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
                        u64 vaddr = be64_to_cpu(reth->vaddr);
                        int ok;
 
-                       ok = hfi1_rkey_ok(qp, &e->rdma_sge, len, vaddr, rkey,
-                                         IB_ACCESS_REMOTE_READ);
+                       ok = rvt_rkey_ok(qp, &e->rdma_sge, len, vaddr, rkey,
+                                        IB_ACCESS_REMOTE_READ);
                        if (unlikely(!ok))
                                goto unlock_done;
                } else {
@@ -1810,7 +1813,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
                break;
        }
        qp->s_ack_state = OP(ACKNOWLEDGE);
-       qp->s_flags |= HFI1_S_RESP_PENDING;
+       qp->s_flags |= RVT_S_RESP_PENDING;
        qp->r_nak_state = 0;
        hfi1_schedule_send(qp);
 
@@ -1823,7 +1826,7 @@ send_ack:
        return 0;
 }
 
-void hfi1_rc_error(struct hfi1_qp *qp, enum ib_wc_status err)
+void hfi1_rc_error(struct rvt_qp *qp, enum ib_wc_status err)
 {
        unsigned long flags;
        int lastwqe;
@@ -1842,7 +1845,7 @@ void hfi1_rc_error(struct hfi1_qp *qp, enum ib_wc_status err)
        }
 }
 
-static inline void update_ack_queue(struct hfi1_qp *qp, unsigned n)
+static inline void update_ack_queue(struct rvt_qp *qp, unsigned n)
 {
        unsigned next;
 
@@ -1957,7 +1960,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
        u32 rcv_flags = packet->rcv_flags;
        void *data = packet->ebuf;
        u32 tlen = packet->tlen;
-       struct hfi1_qp *qp = packet->qp;
+       struct rvt_qp *qp = packet->qp;
        struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
        struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
        struct hfi1_other_headers *ohdr = packet->ohdr;
@@ -2054,7 +2057,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
                break;
        }
 
-       if (qp->state == IB_QPS_RTR && !(qp->r_flags & HFI1_R_COMM_EST))
+       if (qp->state == IB_QPS_RTR && !(qp->r_flags & RVT_R_COMM_EST))
                qp_comm_est(qp);
 
        /* OK, process the packet. */
@@ -2124,7 +2127,7 @@ send_last:
                hfi1_copy_sge(&qp->r_sge, data, tlen, 1);
                hfi1_put_ss(&qp->r_sge);
                qp->r_msn++;
-               if (!test_and_clear_bit(HFI1_R_WRID_VALID, &qp->r_aflags))
+               if (!test_and_clear_bit(RVT_R_WRID_VALID, &qp->r_aflags))
                        break;
                wc.wr_id = qp->r_wr_id;
                wc.status = IB_WC_SUCCESS;
@@ -2174,8 +2177,8 @@ send_last:
                        int ok;
 
                        /* Check rkey & NAK */
-                       ok = hfi1_rkey_ok(qp, &qp->r_sge.sge, qp->r_len, vaddr,
-                                         rkey, IB_ACCESS_REMOTE_WRITE);
+                       ok = rvt_rkey_ok(qp, &qp->r_sge.sge, qp->r_len, vaddr,
+                                        rkey, IB_ACCESS_REMOTE_WRITE);
                        if (unlikely(!ok))
                                goto nack_acc;
                        qp->r_sge.num_sge = 1;
@@ -2200,7 +2203,7 @@ send_last:
                goto send_last;
 
        case OP(RDMA_READ_REQUEST): {
-               struct hfi1_ack_entry *e;
+               struct rvt_ack_entry *e;
                u32 len;
                u8 next;
 
@@ -2218,7 +2221,7 @@ send_last:
                }
                e = &qp->s_ack_queue[qp->r_head_ack_queue];
                if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) {
-                       hfi1_put_mr(e->rdma_sge.mr);
+                       rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
                reth = &ohdr->u.rc.reth;
@@ -2229,8 +2232,8 @@ send_last:
                        int ok;
 
                        /* Check rkey & NAK */
-                       ok = hfi1_rkey_ok(qp, &e->rdma_sge, len, vaddr,
-                                         rkey, IB_ACCESS_REMOTE_READ);
+                       ok = rvt_rkey_ok(qp, &e->rdma_sge, len, vaddr,
+                                        rkey, IB_ACCESS_REMOTE_READ);
                        if (unlikely(!ok))
                                goto nack_acc_unlck;
                        /*
@@ -2261,7 +2264,7 @@ send_last:
                qp->r_head_ack_queue = next;
 
                /* Schedule the send tasklet. */
-               qp->s_flags |= HFI1_S_RESP_PENDING;
+               qp->s_flags |= RVT_S_RESP_PENDING;
                hfi1_schedule_send(qp);
 
                spin_unlock_irqrestore(&qp->s_lock, flags);
@@ -2273,7 +2276,7 @@ send_last:
        case OP(COMPARE_SWAP):
        case OP(FETCH_ADD): {
                struct ib_atomic_eth *ateth;
-               struct hfi1_ack_entry *e;
+               struct rvt_ack_entry *e;
                u64 vaddr;
                atomic64_t *maddr;
                u64 sdata;
@@ -2293,7 +2296,7 @@ send_last:
                }
                e = &qp->s_ack_queue[qp->r_head_ack_queue];
                if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) {
-                       hfi1_put_mr(e->rdma_sge.mr);
+                       rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
                ateth = &ohdr->u.atomic_eth;
@@ -2303,9 +2306,9 @@ send_last:
                        goto nack_inv_unlck;
                rkey = be32_to_cpu(ateth->rkey);
                /* Check rkey & NAK */
-               if (unlikely(!hfi1_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
-                                          vaddr, rkey,
-                                          IB_ACCESS_REMOTE_ATOMIC)))
+               if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
+                                         vaddr, rkey,
+                                         IB_ACCESS_REMOTE_ATOMIC)))
                        goto nack_acc_unlck;
                /* Perform atomic OP and save result. */
                maddr = (atomic64_t *) qp->r_sge.sge.vaddr;
@@ -2315,7 +2318,7 @@ send_last:
                        (u64) cmpxchg((u64 *) qp->r_sge.sge.vaddr,
                                      be64_to_cpu(ateth->compare_data),
                                      sdata);
-               hfi1_put_mr(qp->r_sge.sge.mr);
+               rvt_put_mr(qp->r_sge.sge.mr);
                qp->r_sge.num_sge = 0;
                e->opcode = opcode;
                e->sent = 0;
@@ -2328,7 +2331,7 @@ send_last:
                qp->r_head_ack_queue = next;
 
                /* Schedule the send tasklet. */
-               qp->s_flags |= HFI1_S_RESP_PENDING;
+               qp->s_flags |= RVT_S_RESP_PENDING;
                hfi1_schedule_send(qp);
 
                spin_unlock_irqrestore(&qp->s_lock, flags);
@@ -2347,11 +2350,13 @@ send_last:
        qp->r_nak_state = 0;
        /* Send an ACK if requested or required. */
        if (psn & IB_BTH_REQ_ACK) {
+               struct hfi1_qp_priv *priv = qp->priv;
+
                if (packet->numpkt == 0) {
                        rc_cancel_ack(qp);
                        goto send_ack;
                }
-               if (qp->r_adefered >= HFI1_PSN_CREDIT) {
+               if (priv->r_adefered >= HFI1_PSN_CREDIT) {
                        rc_cancel_ack(qp);
                        goto send_ack;
                }
@@ -2359,7 +2364,7 @@ send_last:
                        rc_cancel_ack(qp);
                        goto send_ack;
                }
-               qp->r_adefered++;
+               priv->r_adefered++;
                rc_defered_ack(rcd, qp);
        }
        return;
@@ -2403,7 +2408,7 @@ void hfi1_rc_hdrerr(
        struct hfi1_ctxtdata *rcd,
        struct hfi1_ib_header *hdr,
        u32 rcv_flags,
-       struct hfi1_qp *qp)
+       struct rvt_qp *qp)
 {
        int has_grh = rcv_flags & HFI1_HAS_GRH;
        struct hfi1_other_headers *ohdr;
@@ -2428,7 +2433,7 @@ void hfi1_rc_hdrerr(
        if (opcode < IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) {
                diff = delta_psn(psn, qp->r_psn);
                if (!qp->r_nak_state && diff >= 0) {
-                       ibp->n_rc_seqnak++;
+                       ibp->rvp.n_rc_seqnak++;
                        qp->r_nak_state = IB_NAK_PSN_ERROR;
                        /* Use the expected PSN. */
                        qp->r_ack_psn = qp->r_psn;