linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next v1 07/10] IB/uverbs: Introduce create/destroy SRQ commands over ioctl
Date: Sun, 17 May 2020 20:04:19 -0300	[thread overview]
Message-ID: <20200517230419.GA31678@ziepe.ca> (raw)
In-Reply-To: <20200506082444.14502-8-leon@kernel.org>

On Wed, May 06, 2020 at 11:24:41AM +0300, Leon Romanovsky wrote:
> diff --git a/drivers/infiniband/core/uverbs_std_types_srq.c b/drivers/infiniband/core/uverbs_std_types_srq.c
> new file mode 100644
> index 000000000000..d74601c47d95
> +++ b/drivers/infiniband/core/uverbs_std_types_srq.c
> @@ -0,0 +1,233 @@
> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> +/*
> + * Copyright (c) 2020, Mellanox Technologies inc.  All rights reserved.
> + */
> +
> +#include <rdma/uverbs_std_types.h>
> +#include "rdma_core.h"
> +#include "uverbs.h"
> +
> +static int uverbs_free_srq(struct ib_uobject *uobject,
> +		    enum rdma_remove_reason why,
> +		    struct uverbs_attr_bundle *attrs)
> +{
> +	struct ib_srq *srq = uobject->object;
> +	struct ib_uevent_object *uevent =
> +		container_of(uobject, struct ib_uevent_object, uobject);
> +	enum ib_srq_type srq_type = srq->srq_type;
> +	int ret;
> +
> +	ret = ib_destroy_srq_user(srq, &attrs->driver_udata);
> +	if (ib_is_destroy_retryable(ret, why, uobject))
> +		return ret;
> +
> +	if (srq_type == IB_SRQT_XRC) {
> +		struct ib_usrq_object *us =
> +			container_of(uevent, struct ib_usrq_object, uevent);

Why is this here? The uobject can't be something other than an
ib_usrq_object, so the above uevent should be just

        struct ib_usrq_object *us =
			container_of(uobject, struct ib_usrq_object, uevent.object);

And the other bits simplified

> +static int UVERBS_HANDLER(UVERBS_METHOD_SRQ_CREATE)(
> +	struct uverbs_attr_bundle *attrs)
> +{
> +	struct ib_usrq_object *obj = container_of(
> +		uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_SRQ_HANDLE),
> +		typeof(*obj), uevent.uobject);
> +	struct ib_pd *pd =
> +		uverbs_attr_get_obj(attrs, UVERBS_ATTR_CREATE_SRQ_PD_HANDLE);
> +	struct ib_srq_init_attr attr = {};
> +	struct ib_uobject *uninitialized_var(xrcd_uobj);

Why do we need uninitalized_var? Looks like it should be fine to me

Jason

  reply	other threads:[~2020-05-17 23:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  8:24 [PATCH rdma-next v1 00/10] Enable asynchronous event FD per object Leon Romanovsky
2020-05-06  8:24 ` [PATCH rdma-next v1 01/10] RDMA/core: Allow the ioctl layer to abort a fully created uobject Leon Romanovsky
2020-05-06  8:24 ` [PATCH rdma-next v1 02/10] IB/uverbs: Refactor related objects to use their own asynchronous event FD Leon Romanovsky
2020-05-17 22:52   ` Jason Gunthorpe
2020-05-06  8:24 ` [PATCH rdma-next v1 03/10] IB/uverbs: Extend CQ to get its " Leon Romanovsky
2020-05-17 22:53   ` Jason Gunthorpe
2020-05-06  8:24 ` [PATCH rdma-next v1 04/10] IB/uverbs: Cleanup wq/srq context usage from uverbs layer Leon Romanovsky
2020-05-06  8:24 ` [PATCH rdma-next v1 05/10] RDMA/core: Consolidate ib_create_srq flows Leon Romanovsky
2020-05-06  8:24 ` [PATCH rdma-next v1 06/10] IB/uverbs: Move QP, SRQ, WQ type and flags to UAPI Leon Romanovsky
2020-05-17 22:57   ` Jason Gunthorpe
2020-05-06  8:24 ` [PATCH rdma-next v1 07/10] IB/uverbs: Introduce create/destroy SRQ commands over ioctl Leon Romanovsky
2020-05-17 23:04   ` Jason Gunthorpe [this message]
2020-05-06  8:24 ` [PATCH rdma-next v1 08/10] IB/uverbs: Fix create WQ to use the given user handle Leon Romanovsky
2020-05-06  8:24 ` [PATCH rdma-next v1 09/10] IB/uverbs: Introduce create/destroy WQ commands over ioctl Leon Romanovsky
2020-05-17 23:09   ` Jason Gunthorpe
2020-05-06  8:24 ` [PATCH rdma-next v1 10/10] IB/uverbs: Introduce create/destroy QP " Leon Romanovsky
2020-05-17 23:37 ` [PATCH rdma-next v1 00/10] Enable asynchronous event FD per object Jason Gunthorpe
2020-05-18  6:17   ` Leon Romanovsky

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=20200517230419.GA31678@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yishaih@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).