Re: [PATCH rdma-next v1 07/10] IB/uverbs: Introduce create/destroy SRQ commands over ioctl

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

 



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



[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