aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 64f70aa1b3c0..292f55be8cbd 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -75,15 +75,16 @@ static void *get_wqe(struct mthca_srq *srq, int n)
75 75
76/* 76/*
77 * Return a pointer to the location within a WQE that we're using as a 77 * Return a pointer to the location within a WQE that we're using as a
78 * link when the WQE is in the free list. We use an offset of 4 78 * link when the WQE is in the free list. We use the imm field
79 * because in the Tavor case, posting a WQE may overwrite the first 79 * because in the Tavor case, posting a WQE may overwrite the next
80 * four bytes of the previous WQE. The offset avoids corrupting our 80 * segment of the previous WQE, but a receive WQE will never touch the
81 * free list if the WQE has already completed and been put on the free 81 * imm field. This avoids corrupting our free list if the previous
82 * list when we post the next WQE. 82 * WQE has already completed and been put on the free list when we
83 * post the next WQE.
83 */ 84 */
84static inline int *wqe_to_link(void *wqe) 85static inline int *wqe_to_link(void *wqe)
85{ 86{
86 return (int *) (wqe + 4); 87 return (int *) (wqe + offsetof(struct mthca_next_seg, imm));
87} 88}
88 89
89static void mthca_tavor_init_srq_context(struct mthca_dev *dev, 90static void mthca_tavor_init_srq_context(struct mthca_dev *dev,