On Tue, Jul 25, 2023 at 10:55:24AM -0500, Shiraz Saleem wrote: > From: Sindhu Devale <sindhu.devale@xxxxxxxxx> > > Currently the attribute cap.max_send_wr and cap.max_recv_wr > sent from user-space during create QP are the provider computed > SQ/RQ depth as opposed to raw values passed from application. > This inhibits computation of an accurate value for max_send_wr > and max_recv_wr for this QP in the kernel which matches the value > returned in user create QP. Also these capabilities needs to be > reported from the driver in query QP. > > Add support by extending the ABI to allow the raw cap.max_send_wr and > cap.max_recv_wr to be passed from user-space, while keeping compatibility > for the older scheme. > > The internal HW depth and shift needed for the WQs needs to be computed > now for both kernel and user-mode QPs. Add new helpers to assist with this: > irdma_uk_calc_depth_shift_sq, irdma_uk_calc_depth_shift_rq and > irdma_uk_calc_depth_shift_wq. > > Consolidate all the user mode QP setup into a new function > irdma_setup_umode_qp which keeps it with its counterpart > irdma_setup_kmode_qp. > > Signed-off-by: Youvaraj Sagar <youvaraj.sagar@xxxxxxxxx> > Signed-off-by: Sindhu Devale <sindhu.devale@xxxxxxxxx> > Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> > --- > drivers/infiniband/hw/irdma/uk.c | 89 +++++++++++++++--- > drivers/infiniband/hw/irdma/user.h | 10 ++ > drivers/infiniband/hw/irdma/verbs.c | 182 ++++++++++++++++++++++-------------- > drivers/infiniband/hw/irdma/verbs.h | 3 +- > include/uapi/rdma/irdma-abi.h | 6 ++ > 5 files changed, 203 insertions(+), 87 deletions(-) Fixed and applied. diff --git a/drivers/infiniband/hw/irdma/uk.c b/drivers/infiniband/hw/irdma/uk.c index 2986aee3a429..ac650a784245 100644 --- a/drivers/infiniband/hw/irdma/uk.c +++ b/drivers/infiniband/hw/irdma/uk.c @@ -1427,7 +1427,7 @@ static void irdma_setup_connection_wqes(struct irdma_qp_uk *qp, void irdma_uk_calc_shift_wq(struct irdma_qp_uk_init_info *ukinfo, u8 *sq_shift, u8 *rq_shift) { - bool imm_support = ukinfo->uk_attrs->hw_rev >= IRDMA_GEN_2 ? true : false; + bool imm_support = ukinfo->uk_attrs->hw_rev >= IRDMA_GEN_2; irdma_get_wqe_shift(ukinfo->uk_attrs, imm_support ? ukinfo->max_sq_frag_cnt + 1 : @@ -1452,7 +1452,7 @@ void irdma_uk_calc_shift_wq(struct irdma_qp_uk_init_info *ukinfo, u8 *sq_shift, int irdma_uk_calc_depth_shift_sq(struct irdma_qp_uk_init_info *ukinfo, u32 *sq_depth, u8 *sq_shift) { - bool imm_support = ukinfo->uk_attrs->hw_rev >= IRDMA_GEN_2 ? true : false; + bool imm_support = ukinfo->uk_attrs->hw_rev >= IRDMA_GEN_2; int status; irdma_get_wqe_shift(ukinfo->uk_attrs, diff --git a/drivers/infiniband/hw/irdma/verbs.h b/drivers/infiniband/hw/irdma/verbs.h index ebe8bdce2557..5d7b983f47a2 100644 --- a/drivers/infiniband/hw/irdma/verbs.h +++ b/drivers/infiniband/hw/irdma/verbs.h @@ -18,8 +18,8 @@ struct irdma_ucontext { struct list_head qp_reg_mem_list; spinlock_t qp_reg_mem_list_lock; /* protect QP memory list */ int abi_ver; - bool legacy_mode:1; - bool use_raw_attrs:1; + u8 legacy_mode : 1; + u8 use_raw_attrs : 1; }; struct irdma_pd {