Re: [PATCH v5 for-next 7/7] RDMA/bnxt_re: Enable low latency push

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 12, 2023 at 11:49 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> 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

Hi Jason,

uverbs_finalize_uobj_create is the last step before uverbs_copy_to.
All the error checking
after this is for uverbs_copy_to.  Can you please clarify what needs
to be changed?
 I took the reference of other modules that call
uverbs_finalize_uobj_create for this implementation
and was not able to find the issue you mentioned.
Thanks,
Selvin

>
> Jason

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux