mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
RDMA/rxe: Compute the maximum sges and inline size based on the WQE size
The SGE buffer size and max_inline data should be derived from the size of the WQE. Each value individually sets the WQE size, so compute the actual sizes based on the actual WQE size and configure the QP with the maximums. Also fix the missing return of the actual maximum capability to the caller. Link: https://lore.kernel.org/r/1578962480-17814-3-git-send-email-rao.shoaib@oracle.com Signed-off-by: Rao Shoaib <rao.shoaib@oracle.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
4e8d683f11
commit
363824f92a
1 changed files with 8 additions and 10 deletions
|
@ -237,19 +237,17 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
|
||||||
*/
|
*/
|
||||||
qp->src_port = RXE_ROCE_V2_SPORT +
|
qp->src_port = RXE_ROCE_V2_SPORT +
|
||||||
(hash_32_generic(qp_num(qp), 14) & 0x3fff);
|
(hash_32_generic(qp_num(qp), 14) & 0x3fff);
|
||||||
|
|
||||||
qp->sq.max_wr = init->cap.max_send_wr;
|
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) +
|
/* These caps are limited by rxe_qp_chk_cap() done by the caller */
|
||||||
qp->sq.max_sge * sizeof(struct ib_sge),
|
wqe_size = max_t(int, init->cap.max_send_sge * sizeof(struct ib_sge),
|
||||||
sizeof(struct rxe_send_wqe) +
|
init->cap.max_inline_data);
|
||||||
qp->sq.max_inline);
|
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);
|
||||||
|
|
||||||
qp->sq.queue = rxe_queue_init(rxe,
|
qp->sq.queue = rxe_queue_init(rxe, &qp->sq.max_wr, wqe_size);
|
||||||
&qp->sq.max_wr,
|
|
||||||
wqe_size);
|
|
||||||
if (!qp->sq.queue)
|
if (!qp->sq.queue)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue