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 mlx5-next v2 02/13] net/mlx5: Export flow counter related API
Date: Tue, 29 May 2018 16:09:06 +0300	[thread overview]
Message-ID: <20180529130917.13592-3-leon@kernel.org> (raw)
In-Reply-To: <20180529130917.13592-1-leon@kernel.org>

From: Raed Salem <raeds@mellanox.com>

Exports counters API to be used in both IB and EN.

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>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.h  | 23 ----------------------
 .../net/ethernet/mellanox/mlx5/core/fs_counters.c  |  3 +++
 include/linux/mlx5/fs.h                            | 22 +++++++++++++++++++++
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index b6da322a8016..40992aed1791 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -131,29 +131,6 @@ struct mlx5_flow_table {
 	struct rhltable			fgs_hash;
 };

-struct mlx5_fc_cache {
-	u64 packets;
-	u64 bytes;
-	u64 lastuse;
-};
-
-struct mlx5_fc {
-	struct rb_node node;
-	struct list_head list;
-
-	/* last{packets,bytes} members are used when calculating the delta since
-	 * last reading
-	 */
-	u64 lastpackets;
-	u64 lastbytes;
-
-	u32 id;
-	bool deleted;
-	bool aging;
-
-	struct mlx5_fc_cache cache ____cacheline_aligned_in_smp;
-};
-
 struct mlx5_ft_underlay_qp {
 	struct list_head list;
 	u32 qpn;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index b7ab929d5f8e..10f407843e03 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -243,6 +243,7 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging)

 	return ERR_PTR(err);
 }
+EXPORT_SYMBOL(mlx5_fc_create);

 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
 {
@@ -260,6 +261,7 @@ void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
 	mlx5_cmd_fc_free(dev, counter->id);
 	kfree(counter);
 }
+EXPORT_SYMBOL(mlx5_fc_destroy);

 int mlx5_init_fc_stats(struct mlx5_core_dev *dev)
 {
@@ -317,6 +319,7 @@ int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,
 {
 	return mlx5_cmd_fc_query(dev, id, packets, bytes);
 }
+EXPORT_SYMBOL(mlx5_fc_query);

 void mlx5_fc_query_cached(struct mlx5_fc *counter,
 			  u64 *bytes, u64 *packets, u64 *lastuse)
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 9f4d32e41c06..93aab0f055b4 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -186,6 +186,28 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
 void mlx5_fc_query_cached(struct mlx5_fc *counter,
 			  u64 *bytes, u64 *packets, u64 *lastuse);
+int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,
+		  u64 *packets, u64 *bytes);
+
+struct mlx5_fc_cache {
+	u64 packets;
+	u64 bytes;
+	u64 lastuse;
+};
+
+struct mlx5_fc {
+	struct rb_node node;
+	struct list_head list;
+
+	u64 lastpackets;
+	u64 lastbytes;
+
+	u32 id;
+	bool deleted;
+	bool aging;
+	struct mlx5_fc_cache cache ____cacheline_aligned_in_smp;
+};
+
 int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
 int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);

  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 ` Leon Romanovsky [this message]
2018-05-29 13:09 ` [PATCH rdma-next v2 03/13] IB/core: Introduce counters object and its create/destroy Leon Romanovsky
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-3-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).