linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Kamal Heib <kamalheib1@gmail.com>
Cc: linux-rdma@vger.kernel.org, Doug Ledford <dledford@redhat.com>
Subject: Re: [PATCH for-next] RDMA/providers: Fix return value when QP type isn't supported
Date: Wed, 4 Mar 2020 12:14:01 -0400	[thread overview]
Message-ID: <20200304161401.GA5082@ziepe.ca> (raw)
In-Reply-To: <20200130082049.463-1-kamalheib1@gmail.com>

On Thu, Jan 30, 2020 at 10:20:49AM +0200, Kamal Heib wrote:
> The proper return code is "-EOPNOTSUPP" when the requested QP type is
> not supported by the provider.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c     | 2 +-
>  drivers/infiniband/hw/cxgb4/qp.c             | 2 +-
>  drivers/infiniband/hw/hns/hns_roce_qp.c      | 2 +-
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 2 +-
>  drivers/infiniband/hw/mlx4/qp.c              | 2 +-
>  drivers/infiniband/hw/mlx5/qp.c              | 2 +-
>  drivers/infiniband/hw/mthca/mthca_provider.c | 2 +-
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  | 2 +-
>  drivers/infiniband/hw/qedr/verbs.c           | 2 +-
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +-
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 2 +-
>  drivers/infiniband/sw/rdmavt/qp.c            | 2 +-
>  drivers/infiniband/sw/siw/siw_verbs.c        | 2 +-
>  13 files changed, 13 insertions(+), 13 deletions(-)

Well, it looks like we already have providers returning EOPNOTSUPP for
various cases under create_qp, so all callers already need to handle
it.

However, there are still lots of cases even within the create_qp flow
where the return codes are wrong. Below is what I thought for mlx5, so
this problem space needs a lot more attention.

But, fixing the obvious places that check qp_type seems like a
reasonable step, so applied to for-next

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index a4f8e703078718..daa1b6b370e17b 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -2023,7 +2023,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
 
 	if (init_attr->rwq_ind_tbl) {
 		if (!udata)
-			return -ENOSYS;
+			return -EOPNOTSUPP;
 
 		err = create_rss_raw_qp_tir(dev, qp, pd, init_attr, udata);
 		return err;
@@ -2032,7 +2032,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
 	if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) {
 		if (!MLX5_CAP_GEN(mdev, block_lb_mc)) {
 			mlx5_ib_dbg(dev, "block multicast loopback isn't supported\n");
-			return -EINVAL;
+			return -EOPNOTSUPP;
 		} else {
 			qp->flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK;
 		}
@@ -2044,7 +2044,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
 			 IB_QP_CREATE_MANAGED_RECV)) {
 		if (!MLX5_CAP_GEN(mdev, cd)) {
 			mlx5_ib_dbg(dev, "cross-channel isn't supported\n");
-			return -EINVAL;
+			return -EOPNOTSUPP;
 		}
 		if (init_attr->create_flags & IB_QP_CREATE_CROSS_CHANNEL)
 			qp->flags |= MLX5_IB_QP_CROSS_CHANNEL;
@@ -2693,7 +2693,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 		if (init_attr->qp_type == IB_QPT_RAW_PACKET) {
 			if (!ucontext) {
 				mlx5_ib_dbg(dev, "Raw Packet QP is not supported for kernel consumers\n");
-				return ERR_PTR(-EINVAL);
+				return ERR_PTR(-EOPNOTSUPP;
 			} else if (!ucontext->cqe_version) {
 				mlx5_ib_dbg(dev, "Raw Packet QP is only supported for CQE version > 0\n");
 				return ERR_PTR(-EINVAL);
@@ -2735,7 +2735,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 	case IB_QPT_XRC_INI:
 		if (!MLX5_CAP_GEN(dev->mdev, xrc)) {
 			mlx5_ib_dbg(dev, "XRC not supported\n");
-			return ERR_PTR(-ENOSYS);
+			return ERR_PTR(-EOPNOTSUPP);
 		}
 		init_attr->recv_cq = NULL;
 		if (init_attr->qp_type == IB_QPT_XRC_TGT) {
@@ -2789,7 +2789,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 		mlx5_ib_dbg(dev, "unsupported qp type %d\n",
 			    init_attr->qp_type);
 		/* Don't support raw QPs */
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 	}
 
 	if (verbs_init_attr->qp_type == IB_QPT_DRIVER)

      parent reply	other threads:[~2020-03-04 16:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30  8:20 [PATCH for-next] RDMA/providers: Fix return value when QP type isn't supported Kamal Heib
2020-01-30  8:39 ` Leon Romanovsky
2020-01-30 16:07   ` Dennis Dalessandro
2020-02-02  9:29     ` Leon Romanovsky
2020-01-30 16:08 ` Dennis Dalessandro
2020-02-20 23:01 ` Kamal Heib
2020-02-21 16:47   ` Jason Gunthorpe
2020-03-04 16:14 ` Jason Gunthorpe [this message]

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=20200304161401.GA5082@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=kamalheib1@gmail.com \
    --cc=linux-rdma@vger.kernel.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 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).