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>
This commit is contained in:
@@ -96,11 +96,7 @@ static int is_qp0(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp)
|
||||
|
||||
static void *get_wqe(struct mlx4_ib_qp *qp, int offset)
|
||||
{
|
||||
if (qp->buf.nbufs == 1)
|
||||
return qp->buf.u.direct.buf + offset;
|
||||
else
|
||||
return qp->buf.u.page_list[offset >> PAGE_SHIFT].buf +
|
||||
(offset & (PAGE_SIZE - 1));
|
||||
return mlx4_buf_offset(&qp->buf, offset);
|
||||
}
|
||||
|
||||
static void *get_recv_wqe(struct mlx4_ib_qp *qp, int n)
|
||||
|
مرجع در شماره جدید
Block a user