diff mbox series

[rdma-core] providers/i40iw: Return correct value for max_send_wr and max_recv_wr

Message ID 20181108235959.37164-1-tatyana.e.nikolova@intel.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [rdma-core] providers/i40iw: Return correct value for max_send_wr and max_recv_wr | expand

Commit Message

Nikolova, Tatyana E Nov. 8, 2018, 11:59 p.m. UTC
From: "Sindhu, Devale" <sindhu.devale@intel.com>

The max_send_wr and max_recv_wr attributes returned in create QP do not
account for the internally reserved quantas (minimum sized WQE) used in
sizing the WQ. Thus the values reported exceed what can actually be fit
in the WQ.

Fix this accounting for the reserve quantas when returning
max_send_wr/max_recv_wr.

Reported-by: Stefan Assmann <sassmann@redhat.com>
Signed-off-by: Sindhu, Devale <sindhu.devale@intel.com>
Reviewed-by: Shiraz, Saleem <shiraz.saleem@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
---
 providers/i40iw/i40iw_uverbs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jason Gunthorpe Nov. 21, 2018, 10:33 p.m. UTC | #1
On Thu, Nov 08, 2018 at 05:59:59PM -0600, Tatyana Nikolova wrote:
> From: "Sindhu, Devale" <sindhu.devale@intel.com>
> 
> The max_send_wr and max_recv_wr attributes returned in create QP do not
> account for the internally reserved quantas (minimum sized WQE) used in
> sizing the WQ. Thus the values reported exceed what can actually be fit
> in the WQ.
> 
> Fix this accounting for the reserve quantas when returning
> max_send_wr/max_recv_wr.
> 
> Reported-by: Stefan Assmann <sassmann@redhat.com>
> Signed-off-by: Sindhu, Devale <sindhu.devale@intel.com>
> Reviewed-by: Shiraz, Saleem <shiraz.saleem@intel.com>
> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
> ---
>  providers/i40iw/i40iw_uverbs.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied to rdma-core

Thanks,
Jason
diff mbox series

Patch

diff --git a/providers/i40iw/i40iw_uverbs.c b/providers/i40iw/i40iw_uverbs.c
index 9d407c76..63b7206a 100644
--- a/providers/i40iw/i40iw_uverbs.c
+++ b/providers/i40iw/i40iw_uverbs.c
@@ -689,8 +689,11 @@  struct ibv_qp *i40iw_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr
 	info.max_rq_frag_cnt = attr->cap.max_recv_sge;
 	info.max_inline_data = attr->cap.max_inline_data;
 
-	if (!iwvctx->dev.ops_uk.iwarp_qp_uk_init(&iwuqp->qp, &info))
+	if (!iwvctx->dev.ops_uk.iwarp_qp_uk_init(&iwuqp->qp, &info)) {
+		attr->cap.max_send_wr = (sqdepth - I40IW_SQ_RSVD) >> sqshift;
+		attr->cap.max_recv_wr = (rqdepth - I40IW_RQ_RSVD) >> rqshift;
 		return &iwuqp->ibv_qp;
+	}
 
 	i40iw_destroy_vmapped_qp(iwuqp, info.sq);
 err_free_rq_wrid: