From: Jason Gunthorpe <jgg@nvidia.com>
To: Mark Zhang <markzhang@nvidia.com>
Cc: dledford@redhat.com, saeedm@nvidia.com,
linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
aharonl@nvidia.com, netao@nvidia.com, leonro@nvidia.com
Subject: Re: [PATCH rdma-next 03/10] RDMA/counters: Support to allocate per-port optional counter statistics
Date: Tue, 24 Aug 2021 10:14:50 -0300 [thread overview]
Message-ID: <20210824131450.GW1721383@nvidia.com> (raw)
In-Reply-To: <736545a9-c5a8-5f0c-8051-9f519c8bad89@nvidia.com>
On Tue, Aug 24, 2021 at 02:22:52PM +0800, Mark Zhang wrote:
> On 8/24/2021 3:30 AM, Jason Gunthorpe wrote:
> > On Wed, Aug 18, 2021 at 02:24:21PM +0300, Mark Zhang wrote:
> > > From: Aharon Landau <aharonl@nvidia.com>
> > >
> > > Add an alloc_op_port_stats() API, as well as related structures, to support
> > > per-port op_stats allocation during counter module initialization.
> > >
> > > Signed-off-by: Aharon Landau <aharonl@nvidia.com>
> > > Signed-off-by: Neta Ostrovsky <netao@nvidia.com>
> > > Signed-off-by: Mark Zhang <markzhang@nvidia.com>
> > > drivers/infiniband/core/counters.c | 18 ++++++++++++++++++
> > > drivers/infiniband/core/device.c | 1 +
> > > include/rdma/ib_verbs.h | 24 ++++++++++++++++++++++++
> > > include/rdma/rdma_counter.h | 1 +
> > > 4 files changed, 44 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
> > > index df9e6c5e4ddf..b8b6db98bfdf 100644
> > > +++ b/drivers/infiniband/core/counters.c
> > > @@ -611,6 +611,15 @@ void rdma_counter_init(struct ib_device *dev)
> > > port_counter->hstats = dev->ops.alloc_hw_port_stats(dev, port);
> > > if (!port_counter->hstats)
> > > goto fail;
> > > +
> > > + if (dev->ops.alloc_op_port_stats) {
> > > + port_counter->opstats =
> > > + dev->ops.alloc_op_port_stats(dev, port);
> > > + if (!port_counter->opstats)
> > > + goto fail;
> >
> > It would be nicer to change the normal stats to have more detailed
> > meta information instead of adding an entire parallel interface like
> > this.
> >
> > struct rdma_hw_stats {
> > struct mutex lock;
> > unsigned long timestamp;
> > unsigned long lifespan;
> > const char * const *names;
> >
> > Change the names to a struct
> >
> > const struct rdma_hw_stat_desc *descs;
> >
> > struct rdma_hw_stat_desc {
> > const char *name;
> > unsigned int flags;
> > unsigned int private;
> > }
> >
> > and then define a FLAG_OPTIONAL.
> >
> > Then alot of this oddness goes away.
> >
> > You might also need a small allocated bitmap to store the
> > enabled/disabled state
> >
> > Then the series basically boils down to adding some 'modify counter'
> > driver op that flips the enable/disable flag
> >
> > And the netlink patches to expose the additional information.
>
> Maybe it can be defined like this:
>
> struct rdma_stat_desc {
> bool enabled;
This isn't quite a nice because the definition array can't be setup as
a static const inside the driver code. You'd have to memory copy to
set it up.
> What does the "private" field mean? Driver-specific? Aren't all counters
> driver-specific?
The other patch had used it to identify the counter
Jason
next prev parent reply other threads:[~2021-08-24 13:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 11:24 [PATCH rdma-next 00/10] Optional counter statistics support Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 01/10] net/mlx5: Add support in bth_opcode as a match criteria Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 02/10] net/mlx5: Add priorities for counters in RDMA namespaces Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 03/10] RDMA/counters: Support to allocate per-port optional counter statistics Mark Zhang
2021-08-23 19:30 ` Jason Gunthorpe
2021-08-24 6:22 ` Mark Zhang
2021-08-24 13:14 ` Jason Gunthorpe [this message]
2021-08-18 11:24 ` [PATCH rdma-next 04/10] RDMA/mlx5: Add alloc_op_port_stats() support Mark Zhang
2021-08-23 19:19 ` Jason Gunthorpe
2021-08-18 11:24 ` [PATCH rdma-next 05/10] RDMA/mlx5: Add steering support in optional flow counters Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 06/10] RDMA/nldev: Add support to add and remove optional counters Mark Zhang
2021-08-23 19:42 ` Jason Gunthorpe
2021-08-24 2:09 ` Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 07/10] RDMA/mlx5: Add add_op_stat() and remove_op_stat() support Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 08/10] RDMA/nldev: Add support to get optional counters statistics Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 09/10] RDMA/mlx5: Add get_op_stats() support Mark Zhang
2021-08-18 11:24 ` [PATCH rdma-next 10/10] RDMA/nldev: Add support to get current enabled optional counters Mark Zhang
2021-08-23 19:44 ` Jason Gunthorpe
2021-08-24 2:13 ` Mark Zhang
2021-08-24 13:13 ` Jason Gunthorpe
2021-08-23 19:33 ` [PATCH rdma-next 00/10] Optional counter statistics support Jason Gunthorpe
2021-08-24 1:44 ` Mark Zhang
2021-08-24 13:11 ` 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=20210824131450.GW1721383@nvidia.com \
--to=jgg@nvidia.com \
--cc=aharonl@nvidia.com \
--cc=dledford@redhat.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=markzhang@nvidia.com \
--cc=netao@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.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).