aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/srq.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-02-07 00:07:54 -0500
committerRoland Dreier <rolandd@cisco.com>2008-02-07 00:07:54 -0500
commit1c69fc2a9012e160c8d459f63df74a6b01db8322 (patch)
treea32a2be6b2c8b9f5c4e006bacebc1eeb723e2ff5 /drivers/infiniband/hw/mlx4/srq.c
parent21511abd0a248a3f225d3b611cfabb93124605a7 (diff)
IB/mlx4: Consolidate code to get an entry from a struct mlx4_buf
We use struct mlx4_buf for kernel QP, CQ and SRQ buffers, and the code to look up an entry is duplicated in get_cqe_from_buf() and the QP and SRQ versions of get_wqe(). Factor this out into mlx4_buf_offset(). This will also make it easier to switch over to using vmap() for buffers. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/srq.c')
-rw-r--r--drivers/infiniband/hw/mlx4/srq.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index e7e9a3d0dac..beaa3b06cf5 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -38,13 +38,7 @@
38 38
39static void *get_wqe(struct mlx4_ib_srq *srq, int n) 39static void *get_wqe(struct mlx4_ib_srq *srq, int n)
40{ 40{
41 int offset = n << srq->msrq.wqe_shift; 41 return mlx4_buf_offset(&srq->buf, n << srq->msrq.wqe_shift);
42
43 if (srq->buf.nbufs == 1)
44 return srq->buf.u.direct.buf + offset;
45 else
46 return srq->buf.u.page_list[offset >> PAGE_SHIFT].buf +
47 (offset & (PAGE_SIZE - 1));
48} 42}
49 43
50static void mlx4_ib_srq_event(struct mlx4_srq *srq, enum mlx4_event type) 44static void mlx4_ib_srq_event(struct mlx4_srq *srq, enum mlx4_event type)