mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
RDMA/bnxt_re: Update msn table size for app allocated QPs
For app allocated QPs, the driver shouldn't use slots/round-up logic to compute the msn table size. The application handles this logic and computes 'sq_npsn' and passes it to the driver using a new uapi parameter. Link: https://patch.msgid.link/r/20260519150041.7251-5-sriharsha.basavapatna@broadcom.com Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
6e27c30bfd
commit
9ce2a8c81c
|
|
@ -1159,29 +1159,39 @@ static int bnxt_re_setup_sginfo(struct bnxt_re_dev *rdev,
|
|||
static int bnxt_re_get_psn_bytes(struct bnxt_re_dev *rdev,
|
||||
struct bnxt_re_ucontext *cntx,
|
||||
struct bnxt_qplib_qp *qplib_qp,
|
||||
struct bnxt_re_qp_req *ureq)
|
||||
struct bnxt_re_qp_req *ureq,
|
||||
bool fixed_que_attr)
|
||||
{
|
||||
int psn_sz, psn_nume;
|
||||
|
||||
psn_sz = bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx) ?
|
||||
sizeof(struct sq_psn_search_ext) :
|
||||
sizeof(struct sq_psn_search);
|
||||
if (cntx && bnxt_re_is_var_size_supported(rdev, cntx)) {
|
||||
psn_nume = ureq->sq_slots;
|
||||
if (rdev->dev_attr &&
|
||||
_is_host_msn_table(rdev->dev_attr->dev_cap_flags2))
|
||||
psn_sz = sizeof(struct sq_msn_search);
|
||||
else
|
||||
psn_sz = bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx) ?
|
||||
sizeof(struct sq_psn_search_ext) :
|
||||
sizeof(struct sq_psn_search);
|
||||
if (!fixed_que_attr) {
|
||||
if (cntx && bnxt_re_is_var_size_supported(rdev, cntx)) {
|
||||
psn_nume = ureq->sq_slots;
|
||||
} else {
|
||||
psn_nume = (qplib_qp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) ?
|
||||
qplib_qp->sq.max_wqe : ((qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size) /
|
||||
sizeof(struct bnxt_qplib_sge));
|
||||
}
|
||||
if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2))
|
||||
psn_nume = roundup_pow_of_two(psn_nume);
|
||||
} else {
|
||||
psn_nume = (qplib_qp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) ?
|
||||
qplib_qp->sq.max_wqe : ((qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size) /
|
||||
sizeof(struct bnxt_qplib_sge));
|
||||
psn_nume = ureq->sq_npsn;
|
||||
}
|
||||
if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2))
|
||||
psn_nume = roundup_pow_of_two(psn_nume);
|
||||
|
||||
return psn_nume * psn_sz;
|
||||
}
|
||||
|
||||
static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,
|
||||
struct bnxt_re_qp *qp, struct bnxt_re_ucontext *cntx,
|
||||
struct bnxt_re_qp_req *ureq)
|
||||
struct bnxt_re_qp_req *ureq,
|
||||
bool fixed_que_attr)
|
||||
{
|
||||
struct bnxt_qplib_qp *qplib_qp;
|
||||
struct ib_umem *umem;
|
||||
|
|
@ -1193,7 +1203,7 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,
|
|||
bytes = (qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size);
|
||||
/* Consider mapping PSN search memory only for RC QPs. */
|
||||
if (qplib_qp->type == CMDQ_CREATE_QP_TYPE_RC)
|
||||
bytes += bnxt_re_get_psn_bytes(rdev, cntx, qplib_qp, ureq);
|
||||
bytes += bnxt_re_get_psn_bytes(rdev, cntx, qplib_qp, ureq, fixed_que_attr);
|
||||
|
||||
bytes = PAGE_ALIGN(bytes);
|
||||
umem = ib_umem_get(&rdev->ibdev, ureq->qpsva, bytes,
|
||||
|
|
@ -1647,7 +1657,9 @@ static int bnxt_re_init_qp_type(struct bnxt_re_dev *rdev,
|
|||
return qptype;
|
||||
}
|
||||
|
||||
static void bnxt_re_qp_calculate_msn_psn_size(struct bnxt_re_qp *qp)
|
||||
static void bnxt_re_qp_calculate_msn_psn_size(struct bnxt_re_qp *qp,
|
||||
bool fixed_que_attr,
|
||||
struct bnxt_re_qp_req *req)
|
||||
{
|
||||
struct bnxt_qplib_qp *qplib_qp = &qp->qplib_qp;
|
||||
struct bnxt_qplib_q *sq = &qplib_qp->sq;
|
||||
|
|
@ -1670,12 +1682,17 @@ static void bnxt_re_qp_calculate_msn_psn_size(struct bnxt_re_qp *qp)
|
|||
|
||||
/* Update msn tbl size */
|
||||
if (qplib_qp->is_host_msn_tbl && qplib_qp->psn_sz) {
|
||||
if (wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
|
||||
qplib_qp->msn_tbl_sz =
|
||||
roundup_pow_of_two(bnxt_qplib_set_sq_size(sq, wqe_mode));
|
||||
else
|
||||
qplib_qp->msn_tbl_sz =
|
||||
roundup_pow_of_two(bnxt_qplib_set_sq_size(sq, wqe_mode)) / 2;
|
||||
if (!fixed_que_attr) {
|
||||
if (wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
|
||||
qplib_qp->msn_tbl_sz =
|
||||
roundup_pow_of_two(bnxt_qplib_set_sq_size(sq, wqe_mode));
|
||||
else
|
||||
qplib_qp->msn_tbl_sz =
|
||||
roundup_pow_of_two(bnxt_qplib_set_sq_size(sq, wqe_mode))
|
||||
/ 2;
|
||||
} else {
|
||||
qplib_qp->msn_tbl_sz = req->sq_npsn;
|
||||
}
|
||||
qplib_qp->msn = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1750,12 +1767,12 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
|
|||
bnxt_re_adjust_gsi_sq_attr(qp, init_attr, uctx);
|
||||
|
||||
if (uctx) { /* This will update DPI and qp_handle */
|
||||
rc = bnxt_re_init_user_qp(rdev, pd, qp, uctx, ureq);
|
||||
rc = bnxt_re_init_user_qp(rdev, pd, qp, uctx, ureq, fixed_que_attr);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
bnxt_re_qp_calculate_msn_psn_size(qp);
|
||||
bnxt_re_qp_calculate_msn_psn_size(qp, fixed_que_attr, ureq);
|
||||
|
||||
rc = bnxt_re_setup_qp_hwqs(qp);
|
||||
if (rc)
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ struct bnxt_re_qp_req {
|
|||
__aligned_u64 qp_handle;
|
||||
__aligned_u64 comp_mask;
|
||||
__u32 sq_slots;
|
||||
__u32 sq_npsn;
|
||||
};
|
||||
|
||||
struct bnxt_re_qp_resp {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user