IB/core: Support passing uhw for create_flow
This is required when user-space drivers need to pass extra information regarding how to handle this flow steering specification. Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
ebb6796bd3
commit
59082a327d
|
@ -3513,11 +3513,16 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
|
|
||||||
|
flow_id = qp->device->create_flow(qp, flow_attr,
|
||||||
|
IB_FLOW_DOMAIN_USER, uhw);
|
||||||
|
|
||||||
if (IS_ERR(flow_id)) {
|
if (IS_ERR(flow_id)) {
|
||||||
err = PTR_ERR(flow_id);
|
err = PTR_ERR(flow_id);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
atomic_inc(&qp->usecnt);
|
||||||
|
flow_id->qp = qp;
|
||||||
flow_id->uobject = uobj;
|
flow_id->uobject = uobj;
|
||||||
uobj->object = flow_id;
|
uobj->object = flow_id;
|
||||||
uflow = container_of(uobj, typeof(*uflow), uobject);
|
uflow = container_of(uobj, typeof(*uflow), uobject);
|
||||||
|
|
|
@ -1982,7 +1982,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
|
||||||
if (!qp->device->create_flow)
|
if (!qp->device->create_flow)
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
|
||||||
flow_id = qp->device->create_flow(qp, flow_attr, domain);
|
flow_id = qp->device->create_flow(qp, flow_attr, domain, NULL);
|
||||||
if (!IS_ERR(flow_id)) {
|
if (!IS_ERR(flow_id)) {
|
||||||
atomic_inc(&qp->usecnt);
|
atomic_inc(&qp->usecnt);
|
||||||
flow_id->qp = qp;
|
flow_id->qp = qp;
|
||||||
|
|
|
@ -1847,7 +1847,7 @@ static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
|
||||||
|
|
||||||
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||||
struct ib_flow_attr *flow_attr,
|
struct ib_flow_attr *flow_attr,
|
||||||
int domain)
|
int domain, struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0, j = 0;
|
int err = 0, i = 0, j = 0;
|
||||||
struct mlx4_ib_flow *mflow;
|
struct mlx4_ib_flow *mflow;
|
||||||
|
@ -1865,6 +1865,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||||
(flow_attr->type != IB_FLOW_ATTR_NORMAL))
|
(flow_attr->type != IB_FLOW_ATTR_NORMAL))
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
|
||||||
|
if (udata &&
|
||||||
|
udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
|
||||||
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
|
||||||
memset(type, 0, sizeof(type));
|
memset(type, 0, sizeof(type));
|
||||||
|
|
||||||
mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
|
mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
|
||||||
|
|
|
@ -3245,7 +3245,8 @@ err:
|
||||||
|
|
||||||
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
||||||
struct ib_flow_attr *flow_attr,
|
struct ib_flow_attr *flow_attr,
|
||||||
int domain)
|
int domain,
|
||||||
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct mlx5_ib_dev *dev = to_mdev(qp->device);
|
struct mlx5_ib_dev *dev = to_mdev(qp->device);
|
||||||
struct mlx5_ib_qp *mqp = to_mqp(qp);
|
struct mlx5_ib_qp *mqp = to_mqp(qp);
|
||||||
|
@ -3257,6 +3258,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
||||||
int err;
|
int err;
|
||||||
int underlay_qpn;
|
int underlay_qpn;
|
||||||
|
|
||||||
|
if (udata &&
|
||||||
|
udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
|
||||||
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
|
||||||
if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
|
if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
|
|
@ -2427,7 +2427,8 @@ struct ib_device {
|
||||||
struct ib_flow * (*create_flow)(struct ib_qp *qp,
|
struct ib_flow * (*create_flow)(struct ib_qp *qp,
|
||||||
struct ib_flow_attr
|
struct ib_flow_attr
|
||||||
*flow_attr,
|
*flow_attr,
|
||||||
int domain);
|
int domain,
|
||||||
|
struct ib_udata *udata);
|
||||||
int (*destroy_flow)(struct ib_flow *flow_id);
|
int (*destroy_flow)(struct ib_flow *flow_id);
|
||||||
int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
|
int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
|
||||||
struct ib_mr_status *mr_status);
|
struct ib_mr_status *mr_status);
|
||||||
|
|
Loading…
Reference in New Issue