IB/hfi1, qib, rdmavt: Move AETH defines to rdma/ib_hdrs.h
authorDon Hiatt <don.hiatt@intel.com>
Wed, 8 Feb 2017 13:28:25 +0000 (05:28 -0800)
committerDoug Ledford <dledford@redhat.com>
Sun, 19 Feb 2017 14:18:44 +0000 (09:18 -0500)
Rename RVT AETH defines and export in rdma/ib_hdrs.h

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/rc.c
drivers/infiniband/hw/hfi1/ruc.c
drivers/infiniband/hw/hfi1/trace.c
drivers/infiniband/hw/qib/qib_rc.c
drivers/infiniband/hw/qib/qib_ruc.c
drivers/infiniband/sw/rdmavt/qp.c
drivers/infiniband/sw/rdmavt/rc.c
include/rdma/ib_hdrs.h
include/rdma/rdmavt_qp.h

index 3cddf7d03e70f4743e34d1316f07b3bed04cb9b7..7382be11afcad663424a19e32608c1c1b39c79f7 100644 (file)
@@ -211,9 +211,9 @@ normal:
                ps->s_txreq->ss = NULL;
                if (qp->s_nak_state)
                        ohdr->u.aeth =
-                               cpu_to_be32((qp->r_msn & RVT_MSN_MASK) |
+                               cpu_to_be32((qp->r_msn & IB_MSN_MASK) |
                                            (qp->s_nak_state <<
-                                            RVT_AETH_CREDIT_SHIFT));
+                                            IB_AETH_CREDIT_SHIFT));
                else
                        ohdr->u.aeth = rvt_compute_aeth(qp);
                hwords++;
@@ -758,9 +758,9 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
        if (qp->s_mig_state == IB_MIG_MIGRATED)
                bth0 |= IB_BTH_MIG_REQ;
        if (qp->r_nak_state)
-               ohdr->u.aeth = cpu_to_be32((qp->r_msn & RVT_MSN_MASK) |
+               ohdr->u.aeth = cpu_to_be32((qp->r_msn & IB_MSN_MASK) |
                                            (qp->r_nak_state <<
-                                            RVT_AETH_CREDIT_SHIFT));
+                                            IB_AETH_CREDIT_SHIFT));
        else
                ohdr->u.aeth = rvt_compute_aeth(qp);
        sc5 = ibp->sl_to_sc[qp->remote_ah_attr.sl];
@@ -1157,7 +1157,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
         * request but will include an ACK'ed request(s).
         */
        ack_psn = psn;
-       if (aeth >> RVT_AETH_NAK_SHIFT)
+       if (aeth >> IB_AETH_NAK_SHIFT)
                ack_psn--;
        wqe = rvt_get_swqe_ptr(qp, qp->s_acked);
        ibp = rcd_to_iport(rcd);
@@ -1237,7 +1237,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
                        break;
        }
 
-       switch (aeth >> RVT_AETH_NAK_SHIFT) {
+       switch (aeth >> IB_AETH_NAK_SHIFT) {
        case 0:         /* ACK */
                this_cpu_inc(*ibp->rvp.rc_acks);
                if (qp->s_acked != qp->s_tail) {
@@ -1300,8 +1300,8 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
                        goto bail_stop;
                /* The last valid PSN is the previous PSN. */
                update_last_psn(qp, psn - 1);
-               switch ((aeth >> RVT_AETH_CREDIT_SHIFT) &
-                       RVT_AETH_CREDIT_MASK) {
+               switch ((aeth >> IB_AETH_CREDIT_SHIFT) &
+                       IB_AETH_CREDIT_MASK) {
                case 0: /* PSN sequence error */
                        ibp->rvp.n_seq_naks++;
                        /*
@@ -1431,7 +1431,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,
                /* Update credits for "ghost" ACKs */
                if (diff == 0 && opcode == OP(ACKNOWLEDGE)) {
                        aeth = be32_to_cpu(ohdr->u.aeth);
-                       if ((aeth >> RVT_AETH_NAK_SHIFT) == 0)
+                       if ((aeth >> IB_AETH_NAK_SHIFT) == 0)
                                rvt_get_credit(qp, aeth);
                }
                goto ack_done;
index bdf3697de88136c9def1b0a7a11395647ac07eb1..aa15bcbfb0797c805ecc0ad62149a81d35b7634f 100644 (file)
@@ -580,7 +580,7 @@ rnr_nak:
        if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK))
                goto clr_busy;
        rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer <<
-                               RVT_AETH_CREDIT_SHIFT);
+                               IB_AETH_CREDIT_SHIFT);
        goto clr_busy;
 
 op_err:
index 0985b4f1b9efa7488915521d18e0ba31d1b703ff..e86798af690356ede8fd804e9c3f7175a75f6336 100644 (file)
@@ -130,14 +130,14 @@ const char *parse_everbs_hdrs(
        case OP(RC, ACKNOWLEDGE):
                trace_seq_printf(p, AETH_PRN, be32_to_cpu(eh->aeth) >> 24,
                                 parse_syndrome(be32_to_cpu(eh->aeth) >> 24),
-                                be32_to_cpu(eh->aeth) & RVT_MSN_MASK);
+                                be32_to_cpu(eh->aeth) & IB_MSN_MASK);
                break;
        /* aeth + atomicacketh */
        case OP(RC, ATOMIC_ACKNOWLEDGE):
                trace_seq_printf(p, AETH_PRN " " ATOMICACKETH_PRN,
                                 be32_to_cpu(eh->at.aeth) >> 24,
                                 parse_syndrome(be32_to_cpu(eh->at.aeth) >> 24),
-                                be32_to_cpu(eh->at.aeth) & RVT_MSN_MASK,
+                                be32_to_cpu(eh->at.aeth) & IB_MSN_MASK,
                                 ib_u64_get(&eh->at.atomic_ack_eth));
                break;
        /* atomiceth */
index 2a495fbc6508bac2da284b32f15a4d60ac1471d0..12658e3fe154c8a645daedea8f70ba5a1a69cebf 100644 (file)
@@ -187,9 +187,9 @@ normal:
                qp->s_cur_sge = NULL;
                if (qp->s_nak_state)
                        ohdr->u.aeth =
-                               cpu_to_be32((qp->r_msn & RVT_MSN_MASK) |
+                               cpu_to_be32((qp->r_msn & IB_MSN_MASK) |
                                            (qp->s_nak_state <<
-                                            RVT_AETH_CREDIT_SHIFT));
+                                            IB_AETH_CREDIT_SHIFT));
                else
                        ohdr->u.aeth = rvt_compute_aeth(qp);
                hwords++;
@@ -648,9 +648,9 @@ void qib_send_rc_ack(struct rvt_qp *qp)
        if (qp->s_mig_state == IB_MIG_MIGRATED)
                bth0 |= IB_BTH_MIG_REQ;
        if (qp->r_nak_state)
-               ohdr->u.aeth = cpu_to_be32((qp->r_msn & RVT_MSN_MASK) |
+               ohdr->u.aeth = cpu_to_be32((qp->r_msn & IB_MSN_MASK) |
                                            (qp->r_nak_state <<
-                                            RVT_AETH_CREDIT_SHIFT));
+                                            IB_AETH_CREDIT_SHIFT));
        else
                ohdr->u.aeth = rvt_compute_aeth(qp);
        lrh0 |= ibp->sl_to_vl[qp->remote_ah_attr.sl] << 12 |
@@ -1042,7 +1042,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
         * request but will include an ACK'ed request(s).
         */
        ack_psn = psn;
-       if (aeth >> RVT_AETH_NAK_SHIFT)
+       if (aeth >> IB_AETH_NAK_SHIFT)
                ack_psn--;
        wqe = rvt_get_swqe_ptr(qp, qp->s_acked);
        ibp = to_iport(qp->ibqp.device, qp->port_num);
@@ -1122,7 +1122,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
                        break;
        }
 
-       switch (aeth >> RVT_AETH_NAK_SHIFT) {
+       switch (aeth >> IB_AETH_NAK_SHIFT) {
        case 0:         /* ACK */
                this_cpu_inc(*ibp->rvp.rc_acks);
                if (qp->s_acked != qp->s_tail) {
@@ -1185,8 +1185,8 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
                        goto bail;
                /* The last valid PSN is the previous PSN. */
                update_last_psn(qp, psn - 1);
-               switch ((aeth >> RVT_AETH_CREDIT_SHIFT) &
-                       RVT_AETH_CREDIT_MASK) {
+               switch ((aeth >> IB_AETH_CREDIT_SHIFT) &
+                       IB_AETH_CREDIT_MASK) {
                case 0: /* PSN sequence error */
                        ibp->rvp.n_seq_naks++;
                        /*
@@ -1341,7 +1341,7 @@ static void qib_rc_rcv_resp(struct qib_ibport *ibp,
                /* Update credits for "ghost" ACKs */
                if (diff == 0 && opcode == OP(ACKNOWLEDGE)) {
                        aeth = be32_to_cpu(ohdr->u.aeth);
-                       if ((aeth >> RVT_AETH_NAK_SHIFT) == 0)
+                       if ((aeth >> IB_AETH_NAK_SHIFT) == 0)
                                rvt_get_credit(qp, aeth);
                }
                goto ack_done;
index 58b28412121ddd3bf017890322db91d558c4459a..17655cc3e6fe7b997e336b3834620d50a550db20 100644 (file)
@@ -562,7 +562,7 @@ rnr_nak:
        if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK))
                goto clr_busy;
        rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer <<
-                               RVT_AETH_CREDIT_SHIFT);
+                               IB_AETH_CREDIT_SHIFT);
        goto clr_busy;
 
 op_err:
index 0b97598136b4e062467175584f44b73358d3ed95..f5ad8d4bfb39570a81fc323c296ab3bb364edc0e 100644 (file)
@@ -51,6 +51,7 @@
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <rdma/ib_verbs.h>
+#include <rdma/ib_hdrs.h>
 #include "qp.h"
 #include "vt.h"
 #include "trace.h"
@@ -1961,14 +1962,14 @@ EXPORT_SYMBOL(rvt_rc_error);
  */
 unsigned long rvt_rnr_tbl_to_usec(u32 index)
 {
-       return ib_rvt_rnr_table[(index & RVT_AETH_CREDIT_MASK)];
+       return ib_rvt_rnr_table[(index & IB_AETH_CREDIT_MASK)];
 }
 EXPORT_SYMBOL(rvt_rnr_tbl_to_usec);
 
 static inline unsigned long rvt_aeth_to_usec(u32 aeth)
 {
-       return ib_rvt_rnr_table[(aeth >> RVT_AETH_CREDIT_SHIFT) &
-                                 RVT_AETH_CREDIT_MASK];
+       return ib_rvt_rnr_table[(aeth >> IB_AETH_CREDIT_SHIFT) &
+                                 IB_AETH_CREDIT_MASK];
 }
 
 /*
index b32b5a3853ac4c028d0b4c9e1fbebce9b27d7909..6131cc558bdb959699a3dffcc3c1f59ee24873b1 100644 (file)
@@ -46,8 +46,7 @@
  */
 
 #include <rdma/rdma_vt.h>
-
-#define RVT_AETH_CREDIT_INVAL  RVT_AETH_CREDIT_MASK
+#include <rdma/ib_hdrs.h>
 
 /*
  * Convert the AETH credit code into the number of credits.
@@ -94,14 +93,14 @@ static const u16 credit_table[31] = {
  */
 __be32 rvt_compute_aeth(struct rvt_qp *qp)
 {
-       u32 aeth = qp->r_msn & RVT_MSN_MASK;
+       u32 aeth = qp->r_msn & IB_MSN_MASK;
 
        if (qp->ibqp.srq) {
                /*
                 * Shared receive queues don't generate credits.
                 * Set the credit field to the invalid value.
                 */
-               aeth |= RVT_AETH_CREDIT_INVAL << RVT_AETH_CREDIT_SHIFT;
+               aeth |= IB_AETH_CREDIT_INVAL << IB_AETH_CREDIT_SHIFT;
        } else {
                u32 min, max, x;
                u32 credits;
@@ -143,7 +142,7 @@ __be32 rvt_compute_aeth(struct rvt_qp *qp)
                                min = x;
                        }
                }
-               aeth |= x << RVT_AETH_CREDIT_SHIFT;
+               aeth |= x << IB_AETH_CREDIT_SHIFT;
        }
        return cpu_to_be32(aeth);
 }
@@ -159,7 +158,7 @@ EXPORT_SYMBOL(rvt_compute_aeth);
 void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
 {
        struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device);
-       u32 credit = (aeth >> RVT_AETH_CREDIT_SHIFT) & RVT_AETH_CREDIT_MASK;
+       u32 credit = (aeth >> IB_AETH_CREDIT_SHIFT) & IB_AETH_CREDIT_MASK;
 
        lockdep_assert_held(&qp->s_lock);
        /*
@@ -167,7 +166,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
         * as many packets as we like.  Otherwise, we have to
         * honor the credit field.
         */
-       if (credit == RVT_AETH_CREDIT_INVAL) {
+       if (credit == IB_AETH_CREDIT_INVAL) {
                if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) {
                        qp->s_flags |= RVT_S_UNLIMITED_CREDIT;
                        if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) {
@@ -177,7 +176,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
                }
        } else if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) {
                /* Compute new LSN (i.e., MSN + credit) */
-               credit = (aeth + credit_table[credit]) & RVT_MSN_MASK;
+               credit = (aeth + credit_table[credit]) & IB_MSN_MASK;
                if (rvt_cmp_msn(credit, qp->s_lsn) > 0) {
                        qp->s_lsn = credit;
                        if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) {
index 408439fe911e4144bc9ecc666133f13207c1fe57..c755325f0831c56b7eca923707e2772c52aa08b9 100644 (file)
 #define IB_GRH_FLOW_SHIFT      0
 #define IB_GRH_NEXT_HDR                0x1B
 
+#define IB_AETH_CREDIT_SHIFT   24
+#define IB_AETH_CREDIT_MASK    0x1F
+#define IB_AETH_CREDIT_INVAL   0x1F
+#define IB_AETH_NAK_SHIFT      29
+#define IB_MSN_MASK            0xFFFFFF
+
 struct ib_reth {
        __be64 vaddr;        /* potentially unaligned */
        __be32 rkey;
index 9767549ab42ce73acb267940b32eaf1f5e24fa57..f3816396c76acbc9646cd648b8ed2c493d98bdcf 100644 (file)
@@ -594,11 +594,6 @@ static inline void rvt_qp_swqe_complete(
        }
 }
 
-#define RVT_AETH_CREDIT_SHIFT  24
-#define RVT_AETH_CREDIT_MASK   0x1F
-#define RVT_AETH_NAK_SHIFT     29
-#define RVT_MSN_MASK           0xFFFFFF
-
 /*
  * Compare the lower 24 bits of the msn values.
  * Returns an integer <, ==, or > than zero.