summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ehca/ehca_classes.h
diff options
context:
space:
mode:
authorStefan Roscher <ossrosch@linux.vnet.ibm.com>2008-12-05 11:25:38 -0800
committerRoland Dreier <rolandd@cisco.com>2008-12-05 11:25:38 -0800
commit1c721940ddd6496508f1f2fde5167b1c898b419b (patch)
treed0ea3b596a617a6bdacbe0a23946808be80ba732 /drivers/infiniband/hw/ehca/ehca_classes.h
parent75c21ae9aa75b0452318d05f737ea838672137f5 (diff)
IB/ehca: Replace modulus operations in flush error completion path
With the latest flush error completion patch we introduced modulus operation to calculate the next index within a qmap. Based on comments from other mailing lists we decided to optimize this operation by using an addition and an if-statement instead of modulus, even though this is on the error path. Signed-off-by: Stefan Roscher <stefan.roscher@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_classes.h')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 7fc35cf0cddf..c825142a2fb7 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -175,6 +175,13 @@ struct ehca_queue_map {
unsigned int next_wqe_idx; /* Idx to first wqe to be flushed */
};
+/* function to calculate the next index for the qmap */
+static inline unsigned int next_index(unsigned int cur_index, unsigned int limit)
+{
+ unsigned int temp = cur_index + 1;
+ return (temp == limit) ? 0 : temp;
+}
+
struct ehca_qp {
union {
struct ib_qp ib_qp;