netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Yishai Hadas <yishaih@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	linux-netdev <netdev@vger.kernel.org>
Subject: [PATCH rdma-next v2 4/8] IB: Consider ib_flow creation by the KABI infrastructure
Date: Mon, 23 Jul 2018 15:25:08 +0300	[thread overview]
Message-ID: <20180723122512.20967-5-leon@kernel.org> (raw)
In-Reply-To: <20180723122512.20967-1-leon@kernel.org>

From: Yishai Hadas <yishaih@mellanox.com>

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 <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/uverbs_cmd.c       | 4 ++++
 drivers/infiniband/core/uverbs_std_types.c | 5 +++--
 include/rdma/ib_verbs.h                    | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index e4c298ac5946..312f9dbec09f 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -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);
 
@@ -3590,6 +3593,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);
diff --git a/drivers/infiniband/core/uverbs_std_types.c b/drivers/infiniband/core/uverbs_std_types.c
index 718c8430d364..c1e0492cc78a 100644
--- a/drivers/infiniband/core/uverbs_std_types.c
+++ b/drivers/infiniband/core/uverbs_std_types.c
@@ -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);
 	}
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 2696f1d730a1..d02bbbafbd3c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2079,6 +2079,7 @@ struct ib_flow_attr {
 
 struct ib_flow {
 	struct ib_qp		*qp;
+	struct ib_device	*device;
 	struct ib_uobject	*uobject;
 };
 
-- 
2.14.4

  parent reply	other threads:[~2018-07-23 13:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 12:25 [PATCH rdma-next v2 0/8] Support mlx5 flow steering with RAW data Leon Romanovsky
2018-07-23 12:25 ` [PATCH mlx5-next v2 1/8] net/mlx5: Add forward compatible support for the FTE match data Leon Romanovsky
2018-07-23 21:05   ` Saeed Mahameed
2018-07-23 12:25 ` [PATCH mlx5-next v2 2/8] net/mlx5: Add support for flow table destination number Leon Romanovsky
2018-07-23 21:05   ` Saeed Mahameed
2018-07-23 12:25 ` [PATCH rdma-next v2 3/8] IB/mlx5: Introduce flow steering matcher object Leon Romanovsky
2018-07-23 12:25 ` Leon Romanovsky [this message]
2018-07-23 12:25 ` [PATCH rdma-next v2 5/8] IB/mlx5: Introduce vendor create and destroy flow methods Leon Romanovsky
2018-07-23 12:25 ` [PATCH rdma-next v2 6/8] IB/mlx5: Support adding flow steering rule by raw data Leon Romanovsky
2018-07-23 12:25 ` [PATCH rdma-next v2 7/8] IB/mlx5: Add support for a flow table destination Leon Romanovsky
2018-07-23 12:25 ` [PATCH rdma-next v2 8/8] IB/mlx5: Expose vendor flow trees Leon Romanovsky
2018-07-24  2:42 ` [PATCH rdma-next v2 0/8] Support mlx5 flow steering with RAW data Jason Gunthorpe
2018-07-24  5:56   ` Leon Romanovsky
2018-07-24 20:13     ` Jason Gunthorpe
2018-07-24 20:35       ` Jason Gunthorpe
2018-07-25  5:37       ` Leon Romanovsky
2018-07-25 14:35         ` Jason Gunthorpe
2018-07-26  4:35           ` Leon Romanovsky
2018-07-26 14:58             ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723122512.20967-5-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=yishaih@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).