Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: rao Shoaib <rao.shoaib@oracle.com>
Cc: linux-rdma@vger.kernel.org, monis@mellanox.com,
	dledford@redhat.com, sean.hefty@intel.com,
	hal.rosenstock@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] SGE buffer and max_inline data must have same size
Date: Wed, 15 Jan 2020 14:27:21 -0400
Message-ID: <20200115182721.GE25201@ziepe.ca> (raw)
In-Reply-To: <1578962480-17814-3-git-send-email-rao.shoaib@oracle.com>

On Mon, Jan 13, 2020 at 04:41:20PM -0800, rao Shoaib wrote:
> From: Rao Shoaib <rao.shoaib@oracle.com>
> 
> SGE buffer size and max_inline data should be same. Maximum of the
> two values requested is used.
> 
> Signed-off-by: Rao Shoaib <rao.shoaib@oracle.com>
>  drivers/infiniband/sw/rxe/rxe_qp.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
> index aeea994..41c669c 100644
> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
> @@ -235,18 +235,17 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
>  		return err;
>  	qp->sk->sk->sk_user_data = qp;
>  
> -	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) +
> -			 qp->sq.max_sge * sizeof(struct ib_sge),
> -			 sizeof(struct rxe_send_wqe) +
> -			 qp->sq.max_inline);
> -
> -	qp->sq.queue = rxe_queue_init(rxe,
> -				      &qp->sq.max_wr,
> -				      wqe_size);
> +	wqe_size = max_t(int, init->cap.max_send_sge * sizeof(struct ib_sge),
> +			 init->cap.max_inline_data);
> +	qp->sq.max_sge = wqe_size/sizeof(struct ib_sge);
> +	qp->sq.max_inline = wqe_size;
> +
> +	wqe_size += sizeof(struct rxe_send_wqe);

Where does this limit the user's request to RXE_MAX_WQE_SIZE ?

I seem to recall the if the requested max can't be satisified then
that is an EINVAL?

And the init->cap should be updated with the actual allocation.

So more like:

        if (init->cap.max_send_sge > RXE_MAX_SGE ||
           init->cap.max_inline_data > RXE_MAX_INLINE)
            return -EINVAL;

	wqe_size = max_t(int, init->cap.max_sge * sizeof(struct ib_sge),
			 init->cap.max_inline_data)
                   sizeof(struct rxe_send_wqe);
	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);

Jason

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  0:41 [PATCH v3 0/2] rxe should use same buffer size for SGE's and inline data rao Shoaib
2020-01-14  0:41 ` [PATCH v3 1/2] Introduce maximum WQE size to check limits rao Shoaib
2020-01-14  0:41 ` [PATCH v3 2/2] SGE buffer and max_inline data must have same size rao Shoaib
2020-01-15 18:27   ` Jason Gunthorpe [this message]
2020-01-15 19:57     ` Rao Shoaib
2020-01-15 20:05       ` Rao Shoaib
2020-01-15 20:36       ` Jason Gunthorpe

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200115182721.GE25201@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=monis@mellanox.com \
    --cc=rao.shoaib@oracle.com \
    --cc=sean.hefty@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git