On Mon, Jan 13, 2020 at 04:41:20PM -0800, rao Shoaib wrote:
From: Rao Shoaib <rao.shoaib@xxxxxxxxxx>Where does this limit the user's request to RXE_MAX_WQE_SIZE ?
SGE buffer size and max_inline data should be same. Maximum of the
two values requested is used.
Signed-off-by: Rao Shoaib <rao.shoaib@xxxxxxxxxx>
drivers/infiniband/sw/rxe/rxe_qp.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index aeea994..41c669c 100644
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -235,18 +235,17 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
return err;
qp->sk->sk->sk_user_data = qp;
- qp->sq.max_wr = init->cap.max_send_wr;
- qp->sq.max_sge = init->cap.max_send_sge;
- qp->sq.max_inline = init->cap.max_inline_data;
-
- wqe_size = max_t(int, sizeof(struct rxe_send_wqe) +
- qp->sq.max_sge * sizeof(struct ib_sge),
- sizeof(struct rxe_send_wqe) +
- qp->sq.max_inline);
-
- qp->sq.queue = rxe_queue_init(rxe,
- &qp->sq.max_wr,
- wqe_size);
+ wqe_size = max_t(int, init->cap.max_send_sge * sizeof(struct ib_sge),
+ init->cap.max_inline_data);
+ qp->sq.max_sge = wqe_size/sizeof(struct ib_sge);
+ qp->sq.max_inline = wqe_size;
+
+ wqe_size += sizeof(struct rxe_send_wqe);
I seem to recall the if the requested max can't be satisified then
that is an EINVAL?
And the init->cap should be updated with the actual allocation.
So more like:
if (init->cap.max_send_sge > RXE_MAX_SGE ||
init->cap.max_inline_data > RXE_MAX_INLINE)
return -EINVAL;
wqe_size = max_t(int, init->cap.max_sge * sizeof(struct ib_sge),
init->cap.max_inline_data)
sizeof(struct rxe_send_wqe);
qp->sq.max_sge = init->cap.max_send_sge = wqe_size/sizeof(struct ib_sge);
qp->sq.max_inline = init->cap.max_inline_data = wqe_size;
wqe_size += sizeof(struct rxe_send_wqe);
Jason