RDMA/mlx5: Initial separation of RAW_PACKET QP from common flow

Create initial function for IB_QPT_RAW_PACKET flow.

Link: https://lore.kernel.org/r/20200427154636.381474-13-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Leon Romanovsky 2020-04-27 18:46:12 +03:00 committed by Jason Gunthorpe
parent 2dfac92dbb
commit 5d0dc3d96c

View File

@ -1634,13 +1634,13 @@ static void destroy_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *q
to_mpd(qp->ibqp.pd)->uid);
}
static int create_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
struct ib_pd *pd,
static int create_rss_raw_qp_tir(struct ib_pd *pd, struct mlx5_ib_qp *qp,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata)
{
struct mlx5_ib_ucontext *mucontext = rdma_udata_to_drv_context(
udata, struct mlx5_ib_ucontext, ibucontext);
struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_ib_create_qp_resp resp = {};
int inlen;
int outlen;
@ -1996,9 +1996,6 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
if (mlx5_st < 0)
return -EINVAL;
if (init_attr->rwq_ind_tbl)
return create_rss_raw_qp_tir(dev, qp, pd, init_attr, udata);
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");
@ -2712,6 +2709,18 @@ static size_t process_udata_size(struct ib_qp_init_attr *attr,
return ucmd;
}
static int create_raw_qp(struct ib_pd *pd, struct mlx5_ib_qp *qp,
struct ib_qp_init_attr *attr,
struct mlx5_ib_create_qp *ucmd, struct ib_udata *udata)
{
struct mlx5_ib_dev *dev = to_mdev(pd->device);
if (attr->rwq_ind_tbl)
return create_rss_raw_qp_tir(pd, qp, attr, udata);
return create_qp_common(dev, pd, attr, ucmd, udata, qp);
}
struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata)
@ -2768,6 +2777,9 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
case IB_QPT_DRIVER:
err = create_driver_qp(pd, qp, init_attr, &ucmd, udata);
break;
case IB_QPT_RAW_PACKET:
err = create_raw_qp(pd, qp, init_attr, &ucmd, udata);
break;
default:
err = create_qp_common(dev, pd, init_attr,
(udata) ? &ucmd : NULL, udata, qp);