All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: dledford@redhat.com, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, michael.chan@broadcom.com,
	Eddie Wai <eddie.wai@broadcom.com>,
	Devesh Sharma <devesh.sharma@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Subject: Re: [PATCH for bnxt_re V4 15/21] RDMA/bnxt_re: Support post_recv
Date: Tue, 24 Jan 2017 13:59:43 +0200	[thread overview]
Message-ID: <20170124115943.GF6005@mtr-leonro.local> (raw)
In-Reply-To: <1482320530-5344-16-git-send-email-selvin.xavier@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 3989 bytes --]

On Wed, Dec 21, 2016 at 03:42:04AM -0800, Selvin Xavier wrote:
> Enables the fastpath verb ib_post_recv.
>
> v3: Fixes sparse warnings
>
> Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
> Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
> Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 123 +++++++++++++++++++++++++++++++
>  drivers/infiniband/hw/bnxt_re/ib_verbs.h |   2 +
>  drivers/infiniband/hw/bnxt_re/main.c     |   2 +
>  drivers/infiniband/hw/bnxt_re/qplib_fp.c | 100 +++++++++++++++++++++++++
>  drivers/infiniband/hw/bnxt_re/qplib_fp.h |   8 ++
>  5 files changed, 235 insertions(+)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index e659490..7476994c 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -1637,6 +1637,51 @@ static int bnxt_re_build_qp1_send_v2(struct bnxt_re_qp *qp,
>  	return rc;
>  }
>
> +/* For the MAD layer, it only provides the recv SGE the size of
> + * ib_grh + MAD datagram.  No Ethernet headers, Ethertype, BTH, DETH,
> + * nor RoCE iCRC.  The Cu+ solution must provide buffer for the entire
> + * receive packet (334 bytes) with no VLAN and then copy the GRH
> + * and the MAD datagram out to the provided SGE.
> + */
> +static int bnxt_re_build_qp1_shadow_qp_recv(struct bnxt_re_qp *qp,
> +					    struct ib_recv_wr *wr,
> +					    struct bnxt_qplib_swqe *wqe,
> +					    int payload_size)
> +{
> +	struct bnxt_qplib_sge ref, sge;
> +	u32 rq_prod_index;
> +	struct bnxt_re_sqp_entries *sqp_entry;
> +
> +	rq_prod_index = bnxt_qplib_get_rq_prod_index(&qp->qplib_qp);
> +
> +	if (bnxt_qplib_get_qp1_rq_buf(&qp->qplib_qp, &sge)) {
> +		/* Create 1 SGE to receive the entire
> +		 * ethernet packet
> +		 */
> +		/* Save the reference from ULP */
> +		ref.addr = wqe->sg_list[0].addr;
> +		ref.lkey = wqe->sg_list[0].lkey;
> +		ref.size = wqe->sg_list[0].size;
> +
> +		sqp_entry = &qp->rdev->sqp_tbl[rq_prod_index];
> +
> +		/* SGE 1 */
> +		wqe->sg_list[0].addr = sge.addr;
> +		wqe->sg_list[0].lkey = sge.lkey;
> +		wqe->sg_list[0].size = BNXT_QPLIB_MAX_QP1_RQ_HDR_SIZE_V2;
> +		sge.size -= wqe->sg_list[0].size;
> +
> +		sqp_entry->sge.addr = ref.addr;
> +		sqp_entry->sge.lkey = ref.lkey;
> +		sqp_entry->sge.size = ref.size;
> +		/* Store the wrid for reporting completion */
> +		sqp_entry->wrid = wqe->wr_id;
> +		/* change the wqe->wrid to table index */
> +		wqe->wr_id = rq_prod_index;
> +	}
> +	return 0;
> +}
> +
>  static int is_ud_qp(struct bnxt_re_qp *qp)
>  {
>  	return qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_UD;
> @@ -1983,6 +2028,84 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, struct ib_send_wr *wr,
>  	return rc;
>  }
>
> +static int bnxt_re_post_recv_shadow_qp(struct bnxt_re_dev *rdev,
> +				       struct bnxt_re_qp *qp,
> +				       struct ib_recv_wr *wr)
> +{
> +	struct bnxt_qplib_swqe wqe;
> +	int rc = 0, payload_sz = 0;
> +
> +	memset(&wqe, 0, sizeof(wqe));
> +	while (wr) {
> +		/* House keeping */
> +		memset(&wqe, 0, sizeof(wqe));
> +
> +		/* Common */
> +		wqe.num_sge = wr->num_sge;
> +		if (wr->num_sge > qp->qplib_qp.rq.max_sge) {
> +			dev_err(rdev_to_dev(rdev),
> +				"Limit exceeded for Receive SGEs");
> +			rc = -EINVAL;
> +			goto bad;

"goto bad" directly to other place in while() to call the "break".
It will be more convenient to call "break" here.


> +		}
> +		payload_sz = bnxt_re_build_sgl(wr->sg_list, wqe.sg_list,
> +					       wr->num_sge);
> +		wqe.wr_id = wr->wr_id;
> +		wqe.type = BNXT_QPLIB_SWQE_TYPE_RECV;
> +
> +		if (!rc)

If we are here, we will always have rc == 0.

> +			rc = bnxt_qplib_post_recv(&qp->qplib_qp, &wqe);
> +bad:
> +		if (rc)
> +			break;
> +
> +		wr = wr->next;
> +	}
> +	bnxt_qplib_post_recv_db(&qp->qplib_qp);
> +	return rc;
> +}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-01-24 11:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 11:41 [PATCH for bnxt_re V4 00/21] Broadcom RoCE Driver (bnxt_re) Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 01/21] RDMA/bnxt_re: Add bnxt_re RoCE driver files Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 02/21] RDMA/bnxt_re: Introducing autogenerated Host Software Interface(hsi) file Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 03/21] RDMA/bnxt_re: register with the NIC driver Selvin Xavier
2017-01-18 10:11   ` Leon Romanovsky
2017-02-06 20:26   ` Doug Ledford
2017-02-10 11:41     ` Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 06/21] RDMA/bnxt_re: Support for PD, ucontext and mmap verbs Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 07/21] RDMA/bnxt_re: Support for query and modify device verbs Selvin Xavier
2016-12-21 11:42 ` [PATCH for bnxt_re V4 12/21] RDMA/bnxt_re: Support memory registration verbs Selvin Xavier
2016-12-21 11:42 ` [PATCH for bnxt_re V4 13/21] RDMA/bnxt_re: Support QP verbs Selvin Xavier
2017-01-18  9:16   ` Leon Romanovsky
     [not found] ` <1482320530-5344-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2016-12-21 11:41   ` [PATCH for bnxt_re V4 04/21] RDMA/bnxt_re: Enabling RoCE control path Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 05/21] RDMA/bnxt_re: Adding Notification Queue support Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 08/21] RDMA/bnxt_re: Adding support for port related verbs Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 09/21] RDMA/bnxt_re: Support for GID " Selvin Xavier
2017-01-18  9:50     ` Leon Romanovsky
2016-12-21 11:41   ` [PATCH for bnxt_re V4 10/21] RDMA/bnxt_re: Support for CQ verbs Selvin Xavier
     [not found]     ` <1482320530-5344-11-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-18  8:19       ` Leon Romanovsky
2016-12-21 11:42   ` [PATCH for bnxt_re V4 11/21] RDMA/bnxt_re: Support for AH verbs Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 14/21] RDMA/bnxt_re: Support post_send verb Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 15/21] RDMA/bnxt_re: Support post_recv Selvin Xavier
2017-01-24 11:59     ` Leon Romanovsky [this message]
2016-12-21 11:42   ` [PATCH for bnxt_re V4 16/21] RDMA/bnxt_re: Support poll_cq verb Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 17/21] RDMA/bnxt_re: Handling dispatching of events to IB stack Selvin Xavier
     [not found]     ` <1482320530-5344-18-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-24 12:18       ` Leon Romanovsky
2017-01-25  9:03         ` Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 18/21] RDMA/bnxt_re: Support for DCB Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 21/21] RDMA/bnxt_re: Add bnxt_re driver build support Selvin Xavier
2017-02-07 15:27   ` [PATCH for bnxt_re V4 00/21] Broadcom RoCE Driver (bnxt_re) Doug Ledford
2016-12-21 11:42 ` [PATCH for bnxt_re V4 19/21] RDMA/bnxt_re: Set uverbs command mask Selvin Xavier
2016-12-21 11:42 ` [PATCH for bnxt_re V4 20/21] RDMA/bnxt_re: Add QP event handling Selvin Xavier
2017-01-24 12:20   ` Leon Romanovsky
     [not found]     ` <20170124122008.GH6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-25  9:04       ` Selvin Xavier

Reply instructions:

You may reply publicly 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=20170124115943.GF6005@mtr-leonro.local \
    --to=leon@kernel.org \
    --cc=devesh.sharma@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=eddie.wai@broadcom.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=selvin.xavier@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.