summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca/ipz_pt_fn.h
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@linux.vnet.ibm.com>2006-11-20 23:54:12 +0100
committerRoland Dreier <rolandd@cisco.com>2006-11-29 15:33:08 -0800
commit2771e9ed4702e46c3f4c305eb2e047c251c2ad2b (patch)
treeda6ffee90c3725fb84949cf44ea78f8e8c8965c1 /drivers/infiniband/hw/ehca/ipz_pt_fn.h
parent9ab1ffa8775d9c677b1301cccce8a7d91e5163d0 (diff)
downloadlinux-2771e9ed4702e46c3f4c305eb2e047c251c2ad2b.tar.bz2
IB/ehca: Use WQE offset instead of WQE addr for pending work reqs
This is a patch for ehca to fix a bug in prepare_sqe_to_rts(), which used WQE address to iterate pending work requests. This might cause an access violation since the queue pages can not be assumed to follow each other consecutively. Thus, this patch introduces a few queue functions to determine WQE offset based on its address and uses WQE offset to iterate the pending work requests. Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca/ipz_pt_fn.h')
-rw-r--r--drivers/infiniband/hw/ehca/ipz_pt_fn.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.h b/drivers/infiniband/hw/ehca/ipz_pt_fn.h
index 2f13509d5257..dc3bda2634b7 100644
--- a/drivers/infiniband/hw/ehca/ipz_pt_fn.h
+++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.h
@@ -150,6 +150,21 @@ static inline void *ipz_qeit_reset(struct ipz_queue *queue)
return ipz_qeit_get(queue);
}
+/*
+ * return the q_offset corresponding to an absolute address
+ */
+int ipz_queue_abs_to_offset(struct ipz_queue *queue, u64 addr, u64 *q_offset);
+
+/*
+ * return the next queue offset. don't modify the queue.
+ */
+static inline u64 ipz_queue_advance_offset(struct ipz_queue *queue, u64 offset)
+{
+ offset += queue->qe_size;
+ if (offset >= queue->queue_length) offset = 0;
+ return offset;
+}
+
/* struct generic page table */
struct ipz_pt {
u64 entries[EHCA_PT_ENTRIES];