summaryrefslogtreecommitdiffstats
path: root/include/rdma/rdmavt_qp.h
diff options
context:
space:
mode:
authorBrian Welty <brian.welty@intel.com>2017-02-08 05:27:07 -0800
committerDoug Ledford <dledford@redhat.com>2017-02-19 09:18:38 -0500
commit696513e8cf39ccb8ee8010fd2157f095b3af6a91 (patch)
tree70758428685c90f9c7f11b28c5a6864aed65f82a /include/rdma/rdmavt_qp.h
parentbeb5a0426794c9698c4e0349c626d819b5f3b2c7 (diff)
downloadlinux-stable-696513e8cf39ccb8ee8010fd2157f095b3af6a91.tar.gz
linux-stable-696513e8cf39ccb8ee8010fd2157f095b3af6a91.tar.bz2
linux-stable-696513e8cf39ccb8ee8010fd2157f095b3af6a91.zip
IB/hfi1, qib, rdmavt: Move AETH credit functions into rdmavt
Add rvt_compute_aeth() and rvt_get_credit() as shared functions in rdmavt, moved from hfi1/qib logic. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Brian Welty <brian.welty@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma/rdmavt_qp.h')
-rw-r--r--include/rdma/rdmavt_qp.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h
index eaaba1b6cc57..a92e7dcfb5f5 100644
--- a/include/rdma/rdmavt_qp.h
+++ b/include/rdma/rdmavt_qp.h
@@ -582,6 +582,37 @@ 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.
+ */
+static inline int rvt_cmp_msn(u32 a, u32 b)
+{
+ return (((int)a) - ((int)b)) << 8;
+}
+
+/**
+ * rvt_compute_aeth - compute the AETH (syndrome + MSN)
+ * @qp: the queue pair to compute the AETH for
+ *
+ * Returns the AETH.
+ */
+__be32 rvt_compute_aeth(struct rvt_qp *qp);
+
+/**
+ * rvt_get_credit - flush the send work queue of a QP
+ * @qp: the qp who's send work queue to flush
+ * @aeth: the Acknowledge Extended Transport Header
+ *
+ * The QP s_lock should be held.
+ */
+void rvt_get_credit(struct rvt_qp *qp, u32 aeth);
+
/**
* @qp - the qp pair
* @len - the length