*/
        list_for_each_entry_safe(qp, nqp, &rcd->qp_wait_list, rspwait) {
                list_del_init(&qp->rspwait);
-               if (qp->r_flags & HFI1_R_RSP_NAK) {
-                       qp->r_flags &= ~HFI1_R_RSP_NAK;
+               if (qp->r_flags & HFI1_R_RSP_DEFERED_ACK) {
+                       qp->r_flags &= ~HFI1_R_RSP_DEFERED_ACK;
                        hfi1_send_rc_ack(rcd, qp, 0);
                }
                if (qp->r_flags & HFI1_R_RSP_SEND) {
 
        return;
 }
 
+static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd,
+                                 struct hfi1_qp *qp)
+{
+       if (list_empty(&qp->rspwait)) {
+               qp->r_flags |= HFI1_R_RSP_DEFERED_ACK;
+               atomic_inc(&qp->refcount);
+               list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
+       }
+}
+
 /**
  * rc_rcv_error - process an incoming duplicate or error RC packet
  * @ohdr: the other headers for this packet
                         * in the receive queue have been processed.
                         * Otherwise, we end up propagating congestion.
                         */
-                       if (list_empty(&qp->rspwait)) {
-                               qp->r_flags |= HFI1_R_RSP_NAK;
-                               atomic_inc(&qp->refcount);
-                               list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
-                       }
+                       rc_defered_ack(rcd, qp);
                }
                goto done;
        }
        qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer;
        qp->r_ack_psn = qp->r_psn;
        /* Queue RNR NAK for later */
-       if (list_empty(&qp->rspwait)) {
-               qp->r_flags |= HFI1_R_RSP_NAK;
-               atomic_inc(&qp->refcount);
-               list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
-       }
+       rc_defered_ack(rcd, qp);
        return;
 
 nack_op_err:
        qp->r_nak_state = IB_NAK_REMOTE_OPERATIONAL_ERROR;
        qp->r_ack_psn = qp->r_psn;
        /* Queue NAK for later */
-       if (list_empty(&qp->rspwait)) {
-               qp->r_flags |= HFI1_R_RSP_NAK;
-               atomic_inc(&qp->refcount);
-               list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
-       }
+       rc_defered_ack(rcd, qp);
        return;
 
 nack_inv_unlck:
        qp->r_nak_state = IB_NAK_INVALID_REQUEST;
        qp->r_ack_psn = qp->r_psn;
        /* Queue NAK for later */
-       if (list_empty(&qp->rspwait)) {
-               qp->r_flags |= HFI1_R_RSP_NAK;
-               atomic_inc(&qp->refcount);
-               list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
-       }
+       rc_defered_ack(rcd, qp);
        return;
 
 nack_acc_unlck:
                         * Otherwise, we end up
                         * propagating congestion.
                         */
-                       if (list_empty(&qp->rspwait)) {
-                               qp->r_flags |= HFI1_R_RSP_NAK;
-                               atomic_inc(&qp->refcount);
-                               list_add_tail(
-                                       &qp->rspwait,
-                                       &rcd->qp_wait_list);
-                               }
+                       rc_defered_ack(rcd, qp);
                } /* Out of sequence NAK */
        } /* QP Request NAKs */
 }
 
 /*
  * Bit definitions for r_flags.
  */
-#define HFI1_R_REUSE_SGE 0x01
-#define HFI1_R_RDMAR_SEQ 0x02
-#define HFI1_R_RSP_NAK   0x04
-#define HFI1_R_RSP_SEND  0x08
-#define HFI1_R_COMM_EST  0x10
+#define HFI1_R_REUSE_SGE       0x01
+#define HFI1_R_RDMAR_SEQ       0x02
+/* defer ack until end of interrupt session */
+#define HFI1_R_RSP_DEFERED_ACK 0x04
+/* relay ack to send engine */
+#define HFI1_R_RSP_SEND        0x08
+#define HFI1_R_COMM_EST        0x10
 
 /*
  * Bit definitions for s_flags.