diff mbox

i40iw: Correct values for max_recv_sge, max_send_sge

Message ID 20161110032639.7460-1-henry.orosco@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Henry Orosco Nov. 10, 2016, 3:26 a.m. UTC
When creating QPs, ensure init_attr->cap.max_recv_sge
is clipped to MAX_FRAG_COUNT.

Expose MAX_FRAG_COUNT for max_recv_sge and max_send_sge in
i40iw_query_qp().

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Henry Orosco <henry.orosco@intel.com>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky Nov. 10, 2016, 4:47 p.m. UTC | #1
On Wed, Nov 09, 2016 at 09:26:39PM -0600, Henry Orosco wrote:
> When creating QPs, ensure init_attr->cap.max_recv_sge
> is clipped to MAX_FRAG_COUNT.
>
> Expose MAX_FRAG_COUNT for max_recv_sge and max_send_sge in
> i40iw_query_qp().
>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> Signed-off-by: Henry Orosco <henry.orosco@intel.com>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> index 6329c97..d06fe593 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> @@ -610,6 +610,9 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
>  	if (init_attr->cap.max_send_sge > I40IW_MAX_WQ_FRAGMENT_COUNT)
>  		init_attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
>
> +	if (init_attr->cap.max_recv_sge > I40IW_MAX_WQ_FRAGMENT_COUNT)
> +		init_attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
> +

Just personal preference,
init_attr->cap.max_recv_sge = min(init_attr->cap.max_recv_sge, I40IW_MAX_WQ_FRAGMENT_COUNT);

Looks good,
Reviewed-By: Leon Romanovsky <leonro@mellanox.com>

>  	memset(&init_info, 0, sizeof(init_info));
>
>  	sq_size = init_attr->cap.max_send_wr;
> @@ -815,8 +818,9 @@ static int i40iw_query_qp(struct ib_qp *ibqp,
>  	attr->qp_access_flags = 0;
>  	attr->cap.max_send_wr = qp->qp_uk.sq_size;
>  	attr->cap.max_recv_wr = qp->qp_uk.rq_size;
> -	attr->cap.max_recv_sge = 1;
>  	attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
> +	attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
> +	attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
>  	init_attr->event_handler = iwqp->ibqp.event_handler;
>  	init_attr->qp_context = iwqp->ibqp.qp_context;
>  	init_attr->send_cq = iwqp->ibqp.send_cq;
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 6329c97..d06fe593 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -610,6 +610,9 @@  static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
 	if (init_attr->cap.max_send_sge > I40IW_MAX_WQ_FRAGMENT_COUNT)
 		init_attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
 
+	if (init_attr->cap.max_recv_sge > I40IW_MAX_WQ_FRAGMENT_COUNT)
+		init_attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
+
 	memset(&init_info, 0, sizeof(init_info));
 
 	sq_size = init_attr->cap.max_send_wr;
@@ -815,8 +818,9 @@  static int i40iw_query_qp(struct ib_qp *ibqp,
 	attr->qp_access_flags = 0;
 	attr->cap.max_send_wr = qp->qp_uk.sq_size;
 	attr->cap.max_recv_wr = qp->qp_uk.rq_size;
-	attr->cap.max_recv_sge = 1;
 	attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
+	attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
+	attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
 	init_attr->event_handler = iwqp->ibqp.event_handler;
 	init_attr->qp_context = iwqp->ibqp.qp_context;
 	init_attr->send_cq = iwqp->ibqp.send_cq;