Commit 832666c1 authored by Don Hiatt's avatar Don Hiatt Committed by Doug Ledford

IB/hfi1, qib, rdmavt: Move AETH defines to rdma/ib_hdrs.h

Rename RVT AETH defines and export in rdma/ib_hdrs.h
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDon Hiatt <don.hiatt@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 881fccb8
...@@ -211,9 +211,9 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, ...@@ -211,9 +211,9 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,
ps->s_txreq->ss = NULL; ps->s_txreq->ss = NULL;
if (qp->s_nak_state) if (qp->s_nak_state)
ohdr->u.aeth = 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 << (qp->s_nak_state <<
RVT_AETH_CREDIT_SHIFT)); IB_AETH_CREDIT_SHIFT));
else else
ohdr->u.aeth = rvt_compute_aeth(qp); ohdr->u.aeth = rvt_compute_aeth(qp);
hwords++; hwords++;
...@@ -758,9 +758,9 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, ...@@ -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) if (qp->s_mig_state == IB_MIG_MIGRATED)
bth0 |= IB_BTH_MIG_REQ; bth0 |= IB_BTH_MIG_REQ;
if (qp->r_nak_state) 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 << (qp->r_nak_state <<
RVT_AETH_CREDIT_SHIFT)); IB_AETH_CREDIT_SHIFT));
else else
ohdr->u.aeth = rvt_compute_aeth(qp); ohdr->u.aeth = rvt_compute_aeth(qp);
sc5 = ibp->sl_to_sc[qp->remote_ah_attr.sl]; 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, ...@@ -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). * request but will include an ACK'ed request(s).
*/ */
ack_psn = psn; ack_psn = psn;
if (aeth >> RVT_AETH_NAK_SHIFT) if (aeth >> IB_AETH_NAK_SHIFT)
ack_psn--; ack_psn--;
wqe = rvt_get_swqe_ptr(qp, qp->s_acked); wqe = rvt_get_swqe_ptr(qp, qp->s_acked);
ibp = rcd_to_iport(rcd); ibp = rcd_to_iport(rcd);
...@@ -1237,7 +1237,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1237,7 +1237,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
break; break;
} }
switch (aeth >> RVT_AETH_NAK_SHIFT) { switch (aeth >> IB_AETH_NAK_SHIFT) {
case 0: /* ACK */ case 0: /* ACK */
this_cpu_inc(*ibp->rvp.rc_acks); this_cpu_inc(*ibp->rvp.rc_acks);
if (qp->s_acked != qp->s_tail) { 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, ...@@ -1300,8 +1300,8 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
goto bail_stop; goto bail_stop;
/* The last valid PSN is the previous PSN. */ /* The last valid PSN is the previous PSN. */
update_last_psn(qp, psn - 1); update_last_psn(qp, psn - 1);
switch ((aeth >> RVT_AETH_CREDIT_SHIFT) & switch ((aeth >> IB_AETH_CREDIT_SHIFT) &
RVT_AETH_CREDIT_MASK) { IB_AETH_CREDIT_MASK) {
case 0: /* PSN sequence error */ case 0: /* PSN sequence error */
ibp->rvp.n_seq_naks++; ibp->rvp.n_seq_naks++;
/* /*
...@@ -1431,7 +1431,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp, ...@@ -1431,7 +1431,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,
/* Update credits for "ghost" ACKs */ /* Update credits for "ghost" ACKs */
if (diff == 0 && opcode == OP(ACKNOWLEDGE)) { if (diff == 0 && opcode == OP(ACKNOWLEDGE)) {
aeth = be32_to_cpu(ohdr->u.aeth); 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); rvt_get_credit(qp, aeth);
} }
goto ack_done; goto ack_done;
......
...@@ -580,7 +580,7 @@ static void ruc_loopback(struct rvt_qp *sqp) ...@@ -580,7 +580,7 @@ static void ruc_loopback(struct rvt_qp *sqp)
if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK)) if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK))
goto clr_busy; goto clr_busy;
rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer << rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer <<
RVT_AETH_CREDIT_SHIFT); IB_AETH_CREDIT_SHIFT);
goto clr_busy; goto clr_busy;
op_err: op_err:
......
...@@ -130,14 +130,14 @@ const char *parse_everbs_hdrs( ...@@ -130,14 +130,14 @@ const char *parse_everbs_hdrs(
case OP(RC, ACKNOWLEDGE): case OP(RC, ACKNOWLEDGE):
trace_seq_printf(p, AETH_PRN, be32_to_cpu(eh->aeth) >> 24, trace_seq_printf(p, AETH_PRN, be32_to_cpu(eh->aeth) >> 24,
parse_syndrome(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; break;
/* aeth + atomicacketh */ /* aeth + atomicacketh */
case OP(RC, ATOMIC_ACKNOWLEDGE): case OP(RC, ATOMIC_ACKNOWLEDGE):
trace_seq_printf(p, AETH_PRN " " ATOMICACKETH_PRN, trace_seq_printf(p, AETH_PRN " " ATOMICACKETH_PRN,
be32_to_cpu(eh->at.aeth) >> 24, be32_to_cpu(eh->at.aeth) >> 24,
parse_syndrome(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)); ib_u64_get(&eh->at.atomic_ack_eth));
break; break;
/* atomiceth */ /* atomiceth */
......
...@@ -187,9 +187,9 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp, ...@@ -187,9 +187,9 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
qp->s_cur_sge = NULL; qp->s_cur_sge = NULL;
if (qp->s_nak_state) if (qp->s_nak_state)
ohdr->u.aeth = 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 << (qp->s_nak_state <<
RVT_AETH_CREDIT_SHIFT)); IB_AETH_CREDIT_SHIFT));
else else
ohdr->u.aeth = rvt_compute_aeth(qp); ohdr->u.aeth = rvt_compute_aeth(qp);
hwords++; hwords++;
...@@ -648,9 +648,9 @@ void qib_send_rc_ack(struct rvt_qp *qp) ...@@ -648,9 +648,9 @@ void qib_send_rc_ack(struct rvt_qp *qp)
if (qp->s_mig_state == IB_MIG_MIGRATED) if (qp->s_mig_state == IB_MIG_MIGRATED)
bth0 |= IB_BTH_MIG_REQ; bth0 |= IB_BTH_MIG_REQ;
if (qp->r_nak_state) 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 << (qp->r_nak_state <<
RVT_AETH_CREDIT_SHIFT)); IB_AETH_CREDIT_SHIFT));
else else
ohdr->u.aeth = rvt_compute_aeth(qp); ohdr->u.aeth = rvt_compute_aeth(qp);
lrh0 |= ibp->sl_to_vl[qp->remote_ah_attr.sl] << 12 | 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, ...@@ -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). * request but will include an ACK'ed request(s).
*/ */
ack_psn = psn; ack_psn = psn;
if (aeth >> RVT_AETH_NAK_SHIFT) if (aeth >> IB_AETH_NAK_SHIFT)
ack_psn--; ack_psn--;
wqe = rvt_get_swqe_ptr(qp, qp->s_acked); wqe = rvt_get_swqe_ptr(qp, qp->s_acked);
ibp = to_iport(qp->ibqp.device, qp->port_num); 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, ...@@ -1122,7 +1122,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
break; break;
} }
switch (aeth >> RVT_AETH_NAK_SHIFT) { switch (aeth >> IB_AETH_NAK_SHIFT) {
case 0: /* ACK */ case 0: /* ACK */
this_cpu_inc(*ibp->rvp.rc_acks); this_cpu_inc(*ibp->rvp.rc_acks);
if (qp->s_acked != qp->s_tail) { 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, ...@@ -1185,8 +1185,8 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
goto bail; goto bail;
/* The last valid PSN is the previous PSN. */ /* The last valid PSN is the previous PSN. */
update_last_psn(qp, psn - 1); update_last_psn(qp, psn - 1);
switch ((aeth >> RVT_AETH_CREDIT_SHIFT) & switch ((aeth >> IB_AETH_CREDIT_SHIFT) &
RVT_AETH_CREDIT_MASK) { IB_AETH_CREDIT_MASK) {
case 0: /* PSN sequence error */ case 0: /* PSN sequence error */
ibp->rvp.n_seq_naks++; ibp->rvp.n_seq_naks++;
/* /*
...@@ -1341,7 +1341,7 @@ static void qib_rc_rcv_resp(struct qib_ibport *ibp, ...@@ -1341,7 +1341,7 @@ static void qib_rc_rcv_resp(struct qib_ibport *ibp,
/* Update credits for "ghost" ACKs */ /* Update credits for "ghost" ACKs */
if (diff == 0 && opcode == OP(ACKNOWLEDGE)) { if (diff == 0 && opcode == OP(ACKNOWLEDGE)) {
aeth = be32_to_cpu(ohdr->u.aeth); 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); rvt_get_credit(qp, aeth);
} }
goto ack_done; goto ack_done;
......
...@@ -562,7 +562,7 @@ static void qib_ruc_loopback(struct rvt_qp *sqp) ...@@ -562,7 +562,7 @@ static void qib_ruc_loopback(struct rvt_qp *sqp)
if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK)) if (!(ib_rvt_state_ops[sqp->state] & RVT_PROCESS_RECV_OK))
goto clr_busy; goto clr_busy;
rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer << rvt_add_rnr_timer(sqp, qp->r_min_rnr_timer <<
RVT_AETH_CREDIT_SHIFT); IB_AETH_CREDIT_SHIFT);
goto clr_busy; goto clr_busy;
op_err: op_err:
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <rdma/ib_verbs.h> #include <rdma/ib_verbs.h>
#include <rdma/ib_hdrs.h>
#include "qp.h" #include "qp.h"
#include "vt.h" #include "vt.h"
#include "trace.h" #include "trace.h"
...@@ -1961,14 +1962,14 @@ EXPORT_SYMBOL(rvt_rc_error); ...@@ -1961,14 +1962,14 @@ EXPORT_SYMBOL(rvt_rc_error);
*/ */
unsigned long rvt_rnr_tbl_to_usec(u32 index) 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); EXPORT_SYMBOL(rvt_rnr_tbl_to_usec);
static inline unsigned long rvt_aeth_to_usec(u32 aeth) static inline unsigned long rvt_aeth_to_usec(u32 aeth)
{ {
return ib_rvt_rnr_table[(aeth >> RVT_AETH_CREDIT_SHIFT) & return ib_rvt_rnr_table[(aeth >> IB_AETH_CREDIT_SHIFT) &
RVT_AETH_CREDIT_MASK]; IB_AETH_CREDIT_MASK];
} }
/* /*
......
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
*/ */
#include <rdma/rdma_vt.h> #include <rdma/rdma_vt.h>
#include <rdma/ib_hdrs.h>
#define RVT_AETH_CREDIT_INVAL RVT_AETH_CREDIT_MASK
/* /*
* Convert the AETH credit code into the number of credits. * Convert the AETH credit code into the number of credits.
...@@ -94,14 +93,14 @@ static const u16 credit_table[31] = { ...@@ -94,14 +93,14 @@ static const u16 credit_table[31] = {
*/ */
__be32 rvt_compute_aeth(struct rvt_qp *qp) __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) { if (qp->ibqp.srq) {
/* /*
* Shared receive queues don't generate credits. * Shared receive queues don't generate credits.
* Set the credit field to the invalid value. * 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 { } else {
u32 min, max, x; u32 min, max, x;
u32 credits; u32 credits;
...@@ -143,7 +142,7 @@ __be32 rvt_compute_aeth(struct rvt_qp *qp) ...@@ -143,7 +142,7 @@ __be32 rvt_compute_aeth(struct rvt_qp *qp)
min = x; min = x;
} }
} }
aeth |= x << RVT_AETH_CREDIT_SHIFT; aeth |= x << IB_AETH_CREDIT_SHIFT;
} }
return cpu_to_be32(aeth); return cpu_to_be32(aeth);
} }
...@@ -159,7 +158,7 @@ EXPORT_SYMBOL(rvt_compute_aeth); ...@@ -159,7 +158,7 @@ EXPORT_SYMBOL(rvt_compute_aeth);
void rvt_get_credit(struct rvt_qp *qp, u32 aeth) void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
{ {
struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device); 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); lockdep_assert_held(&qp->s_lock);
/* /*
...@@ -167,7 +166,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth) ...@@ -167,7 +166,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
* as many packets as we like. Otherwise, we have to * as many packets as we like. Otherwise, we have to
* honor the credit field. * honor the credit field.
*/ */
if (credit == RVT_AETH_CREDIT_INVAL) { if (credit == IB_AETH_CREDIT_INVAL) {
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) { if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) {
qp->s_flags |= RVT_S_UNLIMITED_CREDIT; qp->s_flags |= RVT_S_UNLIMITED_CREDIT;
if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) { if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) {
...@@ -177,7 +176,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth) ...@@ -177,7 +176,7 @@ void rvt_get_credit(struct rvt_qp *qp, u32 aeth)
} }
} else if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) { } else if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT)) {
/* Compute new LSN (i.e., MSN + 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) { if (rvt_cmp_msn(credit, qp->s_lsn) > 0) {
qp->s_lsn = credit; qp->s_lsn = credit;
if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) { if (qp->s_flags & RVT_S_WAIT_SSN_CREDIT) {
......
...@@ -75,6 +75,12 @@ ...@@ -75,6 +75,12 @@
#define IB_GRH_FLOW_SHIFT 0 #define IB_GRH_FLOW_SHIFT 0
#define IB_GRH_NEXT_HDR 0x1B #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 { struct ib_reth {
__be64 vaddr; /* potentially unaligned */ __be64 vaddr; /* potentially unaligned */
__be32 rkey; __be32 rkey;
......
...@@ -594,11 +594,6 @@ static inline void rvt_qp_swqe_complete( ...@@ -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. * Compare the lower 24 bits of the msn values.
* Returns an integer <, ==, or > than zero. * Returns an integer <, ==, or > than zero.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment