Commit e51c2fb0 authored by Adit Ranadive's avatar Adit Ranadive Committed by Doug Ledford

RDMA/vmw_pvrdma: Dont hardcode QP header page

Moved the header page count to a macro.
Reported-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: default avatarAdit Ranadive <aditr@vmware.com>
Reviewed-by: default avatarAditya Sarwade <asarwade@vmware.com>
Tested-by: default avatarAndrew Boyer <andrew.boyer@dell.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 6332dee8
......@@ -70,6 +70,7 @@
#define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820
#define PVRDMA_NUM_RING_PAGES 4
#define PVRDMA_QP_NUM_HEADER_PAGES 1
struct pvrdma_dev;
......
......@@ -170,8 +170,9 @@ static int pvrdma_set_sq_size(struct pvrdma_dev *dev, struct ib_qp_cap *req_cap,
sizeof(struct pvrdma_sge) *
qp->sq.max_sg);
/* Note: one extra page for the header. */
qp->npages_send = 1 + (qp->sq.wqe_cnt * qp->sq.wqe_size +
PAGE_SIZE - 1) / PAGE_SIZE;
qp->npages_send = PVRDMA_QP_NUM_HEADER_PAGES +
(qp->sq.wqe_cnt * qp->sq.wqe_size + PAGE_SIZE - 1) /
PAGE_SIZE;
return 0;
}
......@@ -288,7 +289,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
qp->npages = qp->npages_send + qp->npages_recv;
/* Skip header page. */
qp->sq.offset = PAGE_SIZE;
qp->sq.offset = PVRDMA_QP_NUM_HEADER_PAGES * PAGE_SIZE;
/* Recv queue pages are after send pages. */
qp->rq.offset = qp->npages_send * PAGE_SIZE;
......@@ -341,7 +342,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
cmd->qp_type = ib_qp_type_to_pvrdma(init_attr->qp_type);
cmd->access_flags = IB_ACCESS_LOCAL_WRITE;
cmd->total_chunks = qp->npages;
cmd->send_chunks = qp->npages_send - 1;
cmd->send_chunks = qp->npages_send - PVRDMA_QP_NUM_HEADER_PAGES;
cmd->pdir_dma = qp->pdir.dir_dma;
dev_dbg(&dev->pdev->dev, "create queuepair with %d, %d, %d, %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment