Commit bb8865f4 authored by Kamal Heib's avatar Kamal Heib Committed by Jason Gunthorpe

RDMA/providers: Fix return value when QP type isn't supported

The proper return code is "-EOPNOTSUPP" when the requested QP type is
not supported by the provider.

Link: https://lore.kernel.org/r/20200130082049.463-1-kamalheib1@gmail.comSigned-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 5e29d144
...@@ -1141,7 +1141,7 @@ static int bnxt_re_init_qp_type(struct bnxt_re_dev *rdev, ...@@ -1141,7 +1141,7 @@ static int bnxt_re_init_qp_type(struct bnxt_re_dev *rdev,
qptype = __from_ib_qp_type(init_attr->qp_type); qptype = __from_ib_qp_type(init_attr->qp_type);
if (qptype == IB_QPT_MAX) { if (qptype == IB_QPT_MAX) {
ibdev_err(&rdev->ibdev, "QP type 0x%x not supported", qptype); ibdev_err(&rdev->ibdev, "QP type 0x%x not supported", qptype);
qptype = -EINVAL; qptype = -EOPNOTSUPP;
goto out; goto out;
} }
......
...@@ -2127,7 +2127,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, ...@@ -2127,7 +2127,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
pr_debug("ib_pd %p\n", pd); pr_debug("ib_pd %p\n", pd);
if (attrs->qp_type != IB_QPT_RC) if (attrs->qp_type != IB_QPT_RC)
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
php = to_c4iw_pd(pd); php = to_c4iw_pd(pd);
rhp = php->rhp; rhp = php->rhp;
......
...@@ -1261,7 +1261,7 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd, ...@@ -1261,7 +1261,7 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
default:{ default:{
ibdev_err(ibdev, "not support QP type %d\n", ibdev_err(ibdev, "not support QP type %d\n",
init_attr->qp_type); init_attr->qp_type);
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
} }
......
...@@ -617,7 +617,7 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, ...@@ -617,7 +617,7 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
iwqp->ctx_info.qp_compl_ctx = (uintptr_t)qp; iwqp->ctx_info.qp_compl_ctx = (uintptr_t)qp;
if (init_attr->qp_type != IB_QPT_RC) { if (init_attr->qp_type != IB_QPT_RC) {
err_code = -EINVAL; err_code = -EOPNOTSUPP;
goto error; goto error;
} }
if (iwdev->push_mode) if (iwdev->push_mode)
......
...@@ -1636,7 +1636,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, ...@@ -1636,7 +1636,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
} }
default: default:
/* Don't support raw QPs */ /* Don't support raw QPs */
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
return &qp->ibqp; return &qp->ibqp;
......
...@@ -2789,7 +2789,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, ...@@ -2789,7 +2789,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
mlx5_ib_dbg(dev, "unsupported qp type %d\n", mlx5_ib_dbg(dev, "unsupported qp type %d\n",
init_attr->qp_type); init_attr->qp_type);
/* Don't support raw QPs */ /* Don't support raw QPs */
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
if (verbs_init_attr->qp_type == IB_QPT_DRIVER) if (verbs_init_attr->qp_type == IB_QPT_DRIVER)
......
...@@ -561,7 +561,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, ...@@ -561,7 +561,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
} }
default: default:
/* Don't support raw QPs */ /* Don't support raw QPs */
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
} }
if (err) { if (err) {
......
...@@ -1111,7 +1111,7 @@ static int ocrdma_check_qp_params(struct ib_pd *ibpd, struct ocrdma_dev *dev, ...@@ -1111,7 +1111,7 @@ static int ocrdma_check_qp_params(struct ib_pd *ibpd, struct ocrdma_dev *dev,
(attrs->qp_type != IB_QPT_UD)) { (attrs->qp_type != IB_QPT_UD)) {
pr_err("%s(%d) unsupported qp type=0x%x requested\n", pr_err("%s(%d) unsupported qp type=0x%x requested\n",
__func__, dev->id, attrs->qp_type); __func__, dev->id, attrs->qp_type);
return -EINVAL; return -EOPNOTSUPP;
} }
/* Skip the check for QP1 to support CM size of 128 */ /* Skip the check for QP1 to support CM size of 128 */
if ((attrs->qp_type != IB_QPT_GSI) && if ((attrs->qp_type != IB_QPT_GSI) &&
......
...@@ -1186,7 +1186,7 @@ static int qedr_check_qp_attrs(struct ib_pd *ibpd, struct qedr_dev *dev, ...@@ -1186,7 +1186,7 @@ static int qedr_check_qp_attrs(struct ib_pd *ibpd, struct qedr_dev *dev,
DP_DEBUG(dev, QEDR_MSG_QP, DP_DEBUG(dev, QEDR_MSG_QP,
"create qp: unsupported qp type=0x%x requested\n", "create qp: unsupported qp type=0x%x requested\n",
attrs->qp_type); attrs->qp_type);
return -EINVAL; return -EOPNOTSUPP;
} }
if (attrs->cap.max_send_wr > qattr->max_sqe) { if (attrs->cap.max_send_wr > qattr->max_sqe) {
......
...@@ -504,7 +504,7 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd, ...@@ -504,7 +504,7 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
if (init_attr->qp_type != IB_QPT_UD) { if (init_attr->qp_type != IB_QPT_UD) {
usnic_err("%s asked to make a non-UD QP: %d\n", usnic_err("%s asked to make a non-UD QP: %d\n",
dev_name(&us_ibdev->ib_dev.dev), init_attr->qp_type); dev_name(&us_ibdev->ib_dev.dev), init_attr->qp_type);
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
trans_spec = cmd.spec; trans_spec = cmd.spec;
......
...@@ -217,7 +217,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, ...@@ -217,7 +217,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
init_attr->qp_type != IB_QPT_GSI) { init_attr->qp_type != IB_QPT_GSI) {
dev_warn(&dev->pdev->dev, "queuepair type %d not supported\n", dev_warn(&dev->pdev->dev, "queuepair type %d not supported\n",
init_attr->qp_type); init_attr->qp_type);
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
if (is_srq && !dev->dsr->caps.max_srq) { if (is_srq && !dev->dsr->caps.max_srq) {
......
...@@ -1196,7 +1196,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, ...@@ -1196,7 +1196,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
default: default:
/* Don't support raw QPs */ /* Don't support raw QPs */
return ERR_PTR(-EINVAL); return ERR_PTR(-EOPNOTSUPP);
} }
init_attr->cap.max_inline_data = 0; init_attr->cap.max_inline_data = 0;
......
...@@ -323,7 +323,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, ...@@ -323,7 +323,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
} }
if (attrs->qp_type != IB_QPT_RC) { if (attrs->qp_type != IB_QPT_RC) {
siw_dbg(base_dev, "only RC QP's supported\n"); siw_dbg(base_dev, "only RC QP's supported\n");
rv = -EINVAL; rv = -EOPNOTSUPP;
goto err_out; goto err_out;
} }
if ((attrs->cap.max_send_wr > SIW_MAX_QP_WR) || if ((attrs->cap.max_send_wr > SIW_MAX_QP_WR) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment