[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211004180020.GB2515663@nvidia.com>
Date: Mon, 4 Oct 2021 15:00:20 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Doug Ledford <dledford@...hat.com>,
Aharon Landau <aharonl@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Gal Pressman <galpress@...zon.com>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org, Maor Gottlieb <maorg@...dia.com>,
Mark Zhang <markzhang@...dia.com>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Mustafa Ismail <mustafa.ismail@...el.com>,
Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
netdev@...r.kernel.org, Potnuri Bharat Teja <bharat@...lsio.com>,
Saeed Mahameed <saeedm@...dia.com>,
Selvin Xavier <selvin.xavier@...adcom.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
Yishai Hadas <yishaih@...dia.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v2 05/13] RDMA/counter: Add an is_disabled
field in struct rdma_hw_stats
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
Powered by blists - more mailing lists