All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
	andrew.gospodarek@broadcom.com
Subject: Re: [PATCH v5 for-next 7/7] RDMA/bnxt_re: Enable low latency push
Date: Mon, 12 Jun 2023 15:19:38 -0300	[thread overview]
Message-ID: <ZIdhunLGPLg6h5ID@nvidia.com> (raw)
In-Reply-To: <1686563342-15233-8-git-send-email-selvin.xavier@broadcom.com>

On Mon, Jun 12, 2023 at 02:49:02AM -0700, Selvin Xavier wrote:

> +static int UVERBS_HANDLER(BNXT_RE_METHOD_ALLOC_PAGE)(struct uverbs_attr_bundle *attrs)
> +{
> +	struct ib_uobject *uobj = uverbs_attr_get_uobject(attrs, BNXT_RE_ALLOC_PAGE_HANDLE);
> +	enum bnxt_re_alloc_page_type alloc_type;
> +	struct bnxt_re_user_mmap_entry *entry;
> +	enum bnxt_re_mmap_flag mmap_flag;
> +	struct bnxt_qplib_chip_ctx *cctx;
> +	struct bnxt_re_ucontext *uctx;
> +	struct bnxt_re_dev *rdev;
> +	u64 mmap_offset;
> +	u32 length;
> +	u32 dpi;
> +	u64 dbr;
> +	int err;
> +
> +	uctx = container_of(ib_uverbs_get_ucontext(attrs), struct bnxt_re_ucontext, ib_uctx);
> +	if (IS_ERR(uctx))
> +		return PTR_ERR(uctx);
> +
> +	err = uverbs_get_const(&alloc_type, attrs, BNXT_RE_ALLOC_PAGE_TYPE);
> +	if (err)
> +		return err;
> +
> +	rdev = uctx->rdev;
> +	cctx = rdev->chip_ctx;
> +
> +	switch (alloc_type) {
> +	case BNXT_RE_ALLOC_WC_PAGE:
> +		if (cctx->modes.db_push)  {
> +			if (bnxt_qplib_alloc_dpi(&rdev->qplib_res, &uctx->wcdpi,
> +						 uctx, BNXT_QPLIB_DPI_TYPE_WC))
> +				return -ENOMEM;
> +			length = PAGE_SIZE;
> +			dpi = uctx->wcdpi.dpi;
> +			dbr = (u64)uctx->wcdpi.umdbr;
> +			mmap_flag = BNXT_RE_MMAP_WC_DB;
> +		} else {
> +			return -EINVAL;
> +		}
> +
> +		break;
> +
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +
> +	entry = bnxt_re_mmap_entry_insert(uctx, dbr, mmap_flag, &mmap_offset);
> +	if (IS_ERR(entry))
> +		return PTR_ERR(entry);
> +
> +	uobj->object = entry;
> +	uverbs_finalize_uobj_create(attrs, BNXT_RE_ALLOC_PAGE_HANDLE);

uverbs_finalize_uobj_create() is supposed to be called once the
function cannot fail anymore

> +	err = uverbs_copy_to(attrs, BNXT_RE_ALLOC_PAGE_MMAP_OFFSET,
> +			     &mmap_offset, sizeof(mmap_offset));
> +	if (err)
> +		return err;

Because there is no way to undo it on error.

So the error handling here needs adjusting

Jason

  reply	other threads:[~2023-06-12 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12  9:48 [PATCH v5 for-next 0/7] RDMA/bnxt_re: driver update for supporting low latency push Selvin Xavier
2023-06-12  9:48 ` [PATCH v5 for-next 1/7] RDMA/bnxt_re: Use the common mmap helper functions Selvin Xavier
2023-06-12 18:07   ` Jason Gunthorpe
2023-06-13  4:48     ` Selvin Xavier
2023-06-12  9:48 ` [PATCH v5 for-next 2/7] RDMA/bnxt_re: Add disassociate ucontext support Selvin Xavier
2023-06-12  9:48 ` [PATCH v5 for-next 3/7] RDMA/bnxt_re: Optimize the bnxt_re_init_hwrm_hdr usage Selvin Xavier
2023-06-12  9:48 ` [PATCH v5 for-next 4/7] RDMA/bnxt_re: Query function capabilities from firmware Selvin Xavier
2023-06-12  9:49 ` [PATCH v5 for-next 5/7] RDMA/bnxt_re: Move the interface version to chip context structure Selvin Xavier
2023-06-12  9:49 ` [PATCH v5 for-next 6/7] RDMA/bnxt_re: Reorg the bar mapping Selvin Xavier
2023-06-12  9:49 ` [PATCH v5 for-next 7/7] RDMA/bnxt_re: Enable low latency push Selvin Xavier
2023-06-12 18:19   ` Jason Gunthorpe [this message]
2023-06-13  5:23     ` Selvin Xavier
2023-06-13 11:41       ` Jason Gunthorpe
2023-06-13 11:51         ` Selvin Xavier
2023-06-12 18:20   ` Jason Gunthorpe

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=ZIdhunLGPLg6h5ID@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=selvin.xavier@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.