linux-rdma.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>,
	Boris Pismenny <borisp@mellanox.com>,
	Matan Barak <matanb@mellanox.com>,
	Raed Salem <raeds@mellanox.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	linux-netdev <netdev@vger.kernel.org>
Subject: [PATCH rdma-next v2 03/13] IB/core: Introduce counters object and its create/destroy
Date: Tue, 29 May 2018 16:09:07 +0300	[thread overview]
Message-ID: <20180529130917.13592-4-leon@kernel.org> (raw)
In-Reply-To: <20180529130917.13592-1-leon@kernel.org>

From: Raed Salem <raeds@mellanox.com>

A verbs application may need to get statistics and info on various
aspects of a verb object (e.g. Flow, QP, ...), in general case the
application will state which object's counters its interested in
(we refer to this action as attach), bind this new counters object
to the appropriate verb object and on later stage read their values
using the counters object.

This series introduces a general API for counters object that may
accumulate any ib object counters type, bound and read on demand.

Counters instance is allocated on an IB context and belongs to
that context.
Upon successful creation the counters can be bound to a verbs
object so that hardware counter instances can be created and read.

Downstream patches in this series will introduce the attach, bind
and the read functionality.

Counters instance can be de-allocated, upon successful
destruction the related hardware resources are released.

Prior to destroy call the user must first make sure that the counters
is not being used by any IB object, e.g. not attached to any of its
counted type otherwise an EBUSY error is invoked.

Tested-by: Michael Guralnik <michaelgur@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 include/rdma/ib_verbs.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index e849bd0fc618..ce3d39725966 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2212,6 +2212,13 @@ struct ib_port_pkey_list {
 	struct list_head              pkey_list;
 };

+struct ib_counters {
+	struct ib_device	*device;
+	struct ib_uobject	*uobject;
+	/* num of objects attached */
+	atomic_t	usecnt;
+};
+
 struct uverbs_attr_bundle;

 struct ib_device {
@@ -2483,6 +2490,10 @@ struct ib_device {
 	struct ib_mr *             (*reg_dm_mr)(struct ib_pd *pd, struct ib_dm *dm,
 						struct ib_dm_mr_attr *attr,
 						struct uverbs_attr_bundle *attrs);
+	struct ib_counters *	(*create_counters)(struct ib_device *device,
+						   struct uverbs_attr_bundle *attrs);
+	int	(*destroy_counters)(struct ib_counters	*counters);
+
 	/**
 	 * rdma netdev operation
 	 *

  parent reply	other threads:[~2018-05-29 13:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 13:09 [PATCH rdma-next v2 00/13] Verbs flow counters support Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 01/13] IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure Leon Romanovsky
2018-05-29 19:31   ` Ruhl, Michael J
2018-05-29 20:21     ` Jason Gunthorpe
2018-05-29 20:49       ` Ruhl, Michael J
2018-05-29 20:51         ` Jason Gunthorpe
2018-05-29 13:09 ` [PATCH mlx5-next v2 02/13] net/mlx5: Export flow counter related API Leon Romanovsky
2018-05-29 13:09 ` Leon Romanovsky [this message]
2018-05-29 13:09 ` [PATCH rdma-next v2 04/13] IB/uverbs: Add create/destroy counters support Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 05/13] IB/core: Introduce counters read verb Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 06/13] IB/uverbs: Add read counters support Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 07/13] IB/core: Support passing uhw for create_flow Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 08/13] IB/core: Add support for flow counters Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 09/13] IB/uverbs: " Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 10/13] IB/mlx5: Add counters create and destroy support Leon Romanovsky
2018-05-29 13:09 ` [PATCH mlx5-next v2 11/13] IB/mlx5: Add flow counters binding support Leon Romanovsky
2018-05-29 19:56   ` Jason Gunthorpe
2018-05-30 12:31     ` Yishai Hadas
2018-05-30 15:06       ` Jason Gunthorpe
2018-05-30 15:24         ` Yishai Hadas
2018-05-30 15:35           ` Jason Gunthorpe
2018-05-29 13:09 ` [PATCH rdma-next v2 12/13] IB/mlx5: Add flow counters read support Leon Romanovsky
2018-05-29 13:09 ` [PATCH rdma-next v2 13/13] IB/mlx5: Add " Leon Romanovsky

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=20180529130917.13592-4-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=borisp@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=raeds@mellanox.com \
    --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).