Skip to content

Commit

Permalink
IB: Support ib_flow creation in drivers
Browse files Browse the repository at this point in the history
This patch considers the case that ib_flow is created by some device
driver with its specific parameters using the KABI infrastructure.

In that case both QP and ib_uflow_resources might not be applicable.
Downstream patches from this series use the above functionality.

Signed-off-by: Yishai Hadas <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
yishaih authored and jgunthorpe committed Jul 24, 2018
1 parent fd44e38 commit 6cd080a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,9 @@ void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res)
{
unsigned int i;

if (!uflow_res)
return;

for (i = 0; i < uflow_res->collection_num; i++)
atomic_dec(&uflow_res->collection[i]->usecnt);

Expand Down Expand Up @@ -3585,6 +3588,7 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
}
atomic_inc(&qp->usecnt);
flow_id->qp = qp;
flow_id->device = qp->device;
flow_id->uobject = uobj;
uobj->object = flow_id;
uflow = container_of(uobj, typeof(*uflow), uobject);
Expand Down
5 changes: 3 additions & 2 deletions drivers/infiniband/core/uverbs_std_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ static int uverbs_free_flow(struct ib_uobject *uobject,
struct ib_qp *qp = flow->qp;
int ret;

ret = qp->device->destroy_flow(flow);
ret = flow->device->destroy_flow(flow);
if (!ret) {
atomic_dec(&qp->usecnt);
if (qp)
atomic_dec(&qp->usecnt);
ib_uverbs_flow_resources_free(uflow->resources);
}

Expand Down
1 change: 1 addition & 0 deletions include/rdma/ib_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,7 @@ struct ib_flow_attr {

struct ib_flow {
struct ib_qp *qp;
struct ib_device *device;
struct ib_uobject *uobject;
};

Expand Down

0 comments on commit 6cd080a

Please sign in to comment.