diff options
author | Roland Dreier <rolandd@cisco.com> | 2008-02-07 00:07:54 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-02-07 00:07:54 -0500 |
commit | 1c69fc2a9012e160c8d459f63df74a6b01db8322 (patch) | |
tree | a32a2be6b2c8b9f5c4e006bacebc1eeb723e2ff5 /drivers/infiniband/hw/mlx4/qp.c | |
parent | 21511abd0a248a3f225d3b611cfabb93124605a7 (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/qp.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 8cba9c532e64..376db730bc75 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -96,11 +96,7 @@ static int is_qp0(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp) | |||
96 | 96 | ||
97 | static void *get_wqe(struct mlx4_ib_qp *qp, int offset) | 97 | static void *get_wqe(struct mlx4_ib_qp *qp, int offset) |
98 | { | 98 | { |
99 | if (qp->buf.nbufs == 1) | 99 | return mlx4_buf_offset(&qp->buf, offset); |
100 | return qp->buf.u.direct.buf + offset; | ||
101 | else | ||
102 | return qp->buf.u.page_list[offset >> PAGE_SHIFT].buf + | ||
103 | (offset & (PAGE_SIZE - 1)); | ||
104 | } | 100 | } |
105 | 101 | ||
106 | static void *get_recv_wqe(struct mlx4_ib_qp *qp, int n) | 102 | static void *get_recv_wqe(struct mlx4_ib_qp *qp, int n) |