public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Aharon Landau <aharonl@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	Gal Pressman <galpress@amazon.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	Maor Gottlieb <maorg@nvidia.com>,
	Mark Zhang <markzhang@nvidia.com>,
	Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
	Mustafa Ismail <mustafa.ismail@intel.com>,
	Naresh Kumar PBS <nareshkumar.pbs@broadcom.com>,
	netdev@vger.kernel.org, Potnuri Bharat Teja <bharat@chelsio.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	Shiraz Saleem <shiraz.saleem@intel.com>,
	Yishai Hadas <yishaih@nvidia.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>
Subject: Re: [PATCH rdma-next v2 05/13] RDMA/counter: Add an is_disabled field in struct rdma_hw_stats
Date: Mon, 4 Oct 2021 15:00:20 -0300	[thread overview]
Message-ID: <20211004180020.GB2515663@nvidia.com> (raw)
In-Reply-To: <1d49884d3e77273fe714cc49d688cc0c1bae2e80.1632988543.git.leonro@nvidia.com>

On Thu, Sep 30, 2021 at 11:02:21AM +0300, Leon Romanovsky wrote:
> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> index 3f6b98a87566..67519730b1ac 100644
> +++ b/drivers/infiniband/core/nldev.c
> @@ -968,15 +968,21 @@ static int fill_stat_counter_hwcounters(struct sk_buff *msg,
>  	if (!table_attr)
>  		return -EMSGSIZE;
>  
> -	for (i = 0; i < st->num_counters; i++)
> +	mutex_lock(&st->lock);
> +	for (i = 0; i < st->num_counters; i++) {
> +		if (test_bit(i, st->is_disabled))
> +			continue;
>  		if (rdma_nl_stat_hwcounter_entry(msg, st->descs[i].name,
>  						 st->value[i]))
>  			goto err;
> +	}
> +	mutex_unlock(&st->lock);
>  
>  	nla_nest_end(msg, table_attr);
>  	return 0;
>  
>  err:
> +	mutex_unlock(&st->lock);
>  	nla_nest_cancel(msg, table_attr);
>  	return -EMSGSIZE;
>  }
> @@ -2104,6 +2110,9 @@ static int stat_get_doit_default_counter(struct sk_buff *skb,
>  		goto err_stats;
>  	}
>  	for (i = 0; i < num_cnts; i++) {
> +		if (test_bit(i, stats->is_disabled))
> +			continue;
> +
>  		v = stats->value[i] +
>  			rdma_counter_get_hwstat_value(device, port, i);
>  		if (rdma_nl_stat_hwcounter_entry(msg,
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 71ece4b00234..890593d5100d 100644
> +++ b/drivers/infiniband/core/verbs.c
> @@ -2987,16 +2987,28 @@ struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
>  	if (!stats)
>  		return NULL;
>  
> +	stats->is_disabled = kcalloc(BITS_TO_LONGS(num_counters),
> +				     sizeof(long), GFP_KERNEL);

is_disabled is an unsigned long, not a long

This should just be sizeof(*stats->is_disabled)

Jason

  reply	other threads:[~2021-10-04 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1632988543.git.leonro@nvidia.com>
2021-09-30  8:02 ` [PATCH mlx5-next v2 01/13] net/mlx5: Add ifc bits to support optional counters Leon Romanovsky
2021-09-30  8:02 ` [PATCH mlx5-next v2 02/13] net/mlx5: Add priorities for counters in RDMA namespaces Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 03/13] RDMA/counter: Add a descriptor in struct rdma_hw_stats Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 04/13] RDMA/core: Add a helper API rdma_free_hw_stats_struct Leon Romanovsky
2021-10-04 17:59   ` Jason Gunthorpe
2021-09-30  8:02 ` [PATCH rdma-next v2 05/13] RDMA/counter: Add an is_disabled field in struct rdma_hw_stats Leon Romanovsky
2021-10-04 18:00   ` Jason Gunthorpe [this message]
2021-09-30  8:02 ` [PATCH rdma-next v2 06/13] RDMA/counter: Add optional counter support Leon Romanovsky
2021-10-04 18:01   ` Jason Gunthorpe
2021-09-30  8:02 ` [PATCH rdma-next v2 07/13] RDMA/nldev: Add support to get status of all counters Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 08/13] RDMA/nldev: Allow optional-counter status configuration through RDMA netlink Leon Romanovsky
2021-10-04 18:03   ` Jason Gunthorpe
2021-09-30  8:02 ` [PATCH rdma-next v2 09/13] RDMA/mlx5: Support optional counters in hw_stats initialization Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 10/13] RDMA/mlx5: Add steering support in optional flow counters Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 11/13] RDMA/mlx5: Add modify_op_stat() support Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 12/13] RDMA/mlx5: Add optional counter support in get_hw_stats callback Leon Romanovsky
2021-09-30  8:02 ` [PATCH rdma-next v2 13/13] RDMA/nldev: Add support to get status of all counters Leon Romanovsky
2021-10-04 18:07   ` Jason Gunthorpe
2021-10-05 11:00     ` 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=20211004180020.GB2515663@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=aharonl@nvidia.com \
    --cc=bharat@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=galpress@amazon.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=markzhang@nvidia.com \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    --cc=mustafa.ismail@intel.com \
    --cc=nareshkumar.pbs@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=selvin.xavier@broadcom.com \
    --cc=shiraz.saleem@intel.com \
    --cc=yishaih@nvidia.com \
    --cc=zyjzyj2000@gmail.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