aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4
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 /include/linux/mlx4
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 'include/linux/mlx4')
-rw-r--r--include/linux/mlx4/device.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 222815d91c40..a0afa7511a30 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -308,6 +308,14 @@ struct mlx4_init_port_param {
308int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 308int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
309 struct mlx4_buf *buf); 309 struct mlx4_buf *buf);
310void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 310void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
311static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
312{
313 if (buf->nbufs == 1)
314 return buf->u.direct.buf + offset;
315 else
316 return buf->u.page_list[offset >> PAGE_SHIFT].buf +
317 (offset & (PAGE_SIZE - 1));
318}
311 319
312int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); 320int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn);
313void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); 321void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn);