Re: [PATCH rdma-next 06/12] IB/core: Support passing uhw for create_flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 15, 2018 at 05:09:44PM +0300, Leon Romanovsky wrote:
> From: Matan Barak <matanb@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxx>
> Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx>
> Signed-off-by: Boris Pismenny <borisp@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>  drivers/infiniband/core/uverbs_cmd.c | 7 ++++++-
>  drivers/infiniband/core/verbs.c      | 2 +-
>  drivers/infiniband/hw/mlx4/main.c    | 6 +++++-
>  drivers/infiniband/hw/mlx5/main.c    | 7 ++++++-
>  include/rdma/ib_verbs.h              | 3 ++-
>  5 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index 4e82c882444f..b54e4cca77d3 100644
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -3551,11 +3551,16 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
>  		err = -EINVAL;
>  		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)) {
>  		err = PTR_ERR(flow_id);
>  		goto err_free;
>  	}
> +	atomic_inc(&qp->usecnt);
> +	flow_id->qp = qp;
>  	flow_id->uobject = uobj;
>  	uobj->object = flow_id;
>  	uflow = container_of(uobj, typeof(*uflow), uobject);
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 5b4f116cf95c..efe6cb5576e9 100644
> +++ b/drivers/infiniband/core/verbs.c
> @@ -2034,7 +2034,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
>  	if (!qp->device->create_flow)
>  		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)) {
>  		atomic_inc(&qp->usecnt);
>  		flow_id->qp = qp;
> diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
> index c292704f6916..013e9c383501 100644
> +++ b/drivers/infiniband/hw/mlx4/main.c
> @@ -1873,7 +1873,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,
>  				    struct ib_flow_attr *flow_attr,
> -				    int domain)
> +				    int domain, struct ib_udata *udata)
>  {
>  	int err = 0, i = 0, j = 0;
>  	struct mlx4_ib_flow *mflow;
> @@ -1891,6 +1891,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
>  	    (flow_attr->type != IB_FLOW_ATTR_NORMAL))
>  		return ERR_PTR(-EOPNOTSUPP);
>  
> +	if (udata &&
> +	    udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
> +		return ERR_PTR(-EOPNOTSUPP);

There isn't too much point in this - since ib_uverbs_ex_create_flow
(wrongly) never checked the uhw it means future driver changes can
never rely on a kernel having checked it, so adding a check like this
now is just confusing/pointless :(

But we may as well leave it, I guess. Would be nice to have a warning
comment about this though.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux