All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Yishai Hadas <yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Or Gerlitz <gerlitz.or-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	RDMA mailing list
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-next v1 4/6] IB/mlx5: Handle type IB_QPT_DRIVER when creating a QP
Date: Sun, 31 Dec 2017 12:50:15 -0700	[thread overview]
Message-ID: <20171231195015.GA10159@mellanox.com> (raw)
In-Reply-To: <1e827f07-f8a1-ffa3-7c8b-e90b1107e843-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On Sun, Dec 31, 2017 at 01:45:41PM +0200, Yishai Hadas wrote:
> On 12/29/2017 5:23 PM, Or Gerlitz wrote:
> >validate_driver_qp() deals @ 95% of it's contents with DC but has no
> >DC in it's name, also it does assignment which goes beyond validation.
> >
> 
> OK, will rename it to be prepare_driver_qp().
> 
> The function name follows the input QP type (i.e. IB_QPT_DRIVER) and what it
> does on. Specifically, its purpose is to prepare the input data (ucmd,
> init_attr) to be used later on. Similar name and logic is used as part of RQ
> creation as part of this file. (i.e. prepare_user_rq()).

If we are going to bike shed this to death, here is my
suggestion. Name the function after what it actually does, and tidy
the flags checking to be less dangerous if more QP types are added.

static int set_mlx_qp_type(struct mlx5_ib_dev *dev,
			   struct ib_qp_init_attr *init_attr,
			   struct mlx5_ib_create_qp *ucmd,
			   struct ib_udata *udata)
{
	enum { MLX_QP_FLAGS = MLX5_QP_FLAG_TYPE_DCT | MLX5_QP_FLAG_TYPE_DCI };
	int err;

	if (!udata)
		return -EINVAL;

	if (udata->inlen < sizeof(*ucmd)) {
		mlx5_ib_dbg(dev, "create_qp user command is smaller than expected\n");
		return -EINVAL;
	}
	err = ib_copy_from_udata(ucmd, udata, sizeof(*ucmd));
	if (err)
		return err;

	if ((ucmd->flags & MLX_QP_FLAGS) == MLX5_QP_FLAG_TYPE_DCI)
		init_attr->qp_type = MLX5_IB_QPT_DCI;
	else if ((ucmd->flags & MLX_QP_FLAGS) == MLX5_QP_FLAG_TYPE_DCT)
		init_attr->qp_type = MLX5_IB_QPT_DCT;
 	else {
		mlx5_ib_dbg(dev, "Invalid QP flags\n");
		return -EINVAL;
	}

	if (!MLX5_CAP_GEN(dev->mdev, dct)) {
		mlx5_ib_dbg(dev, "DC transport is not supported\n");
		return -EOPNOTSUPP;
	}

	return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-12-31 19:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-27 17:15 [PATCH rdma-next v1 0/6] Add DC transport support to mlx5 Leon Romanovsky
     [not found] ` <20171227171540.1646-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-27 17:15   ` [PATCH rdma-next v1 1/6] net/mlx5: Add DCT command interface Leon Romanovsky
2017-12-27 17:15   ` [PATCH rdma-next v1 2/6] net/mlx5: Enable DC transport Leon Romanovsky
2017-12-27 17:15   ` [PATCH rdma-next v1 3/6] IB/core: Introduce driver QP type Leon Romanovsky
2017-12-27 17:15   ` [PATCH rdma-next v1 4/6] IB/mlx5: Handle type IB_QPT_DRIVER when creating a QP Leon Romanovsky
     [not found]     ` <20171227171540.1646-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-27 21:16       ` Or Gerlitz
     [not found]         ` <CAJ3xEMiExjjVUOYQsdMiHLNOjB+MOkz4c1TT9AT_inkfGfMuKA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-27 22:02           ` Jason Gunthorpe
     [not found]             ` <20171227220227.GL31310-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-12-28  6:12               ` Or Gerlitz
2017-12-28 10:02               ` Yishai Hadas
     [not found]                 ` <30a35dd5-3046-d7bb-e61f-7d18501fd06c-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-12-29 15:23                   ` Or Gerlitz
     [not found]                     ` <CAJ3xEMhPZfyTZ1Hr8Mwq9xeqV6UKkkVfXNDrx625qoWzAHr6qg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-31 11:45                       ` Yishai Hadas
     [not found]                         ` <1e827f07-f8a1-ffa3-7c8b-e90b1107e843-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-12-31 12:37                           ` Or Gerlitz
     [not found]                             ` <CAJ3xEMhNN4Vz7zxssOhgZzj4yfrC-h7tWn71AvJun29ZHL3wDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-31 13:05                               ` Yishai Hadas
     [not found]                                 ` <ad933caf-4246-1bb0-2d6e-3d3795f2a9c5-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2018-01-01 12:53                                   ` Or Gerlitz
2017-12-31 19:50                           ` Jason Gunthorpe [this message]
     [not found]                             ` <20171231195015.GA10159-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-01 10:14                               ` Moni Shoua
     [not found]                                 ` <CAG9sBKPjhqXTKzvCGp=LXtHEAUXgQa8L4w=OaPKizJsnDQCuuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-01 10:39                                   ` Or Gerlitz
2018-01-02 18:01                   ` Jason Gunthorpe
2017-12-28  6:17       ` Or Gerlitz
     [not found]         ` <CAJ3xEMhoxazkdiO0wpCz-j30x-CAxBk+4sB8NYYugvts0T9s4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-28  9:48           ` Moni Shoua
2017-12-27 17:15   ` [PATCH rdma-next v1 5/6] IB/mlx5: Add support for DC Initiator QP Leon Romanovsky
2017-12-27 17:15   ` [PATCH rdma-next v1 6/6] IB/mlx5: Add support for DC target QP 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=20171231195015.GA10159@mellanox.com \
    --to=jgg-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=gerlitz.or-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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.