lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211004175906.GA2515663@nvidia.com>
Date:   Mon, 4 Oct 2021 14:59:06 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Doug Ledford <dledford@...hat.com>,
        Mark Zhang <markzhang@...dia.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>,
        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 04/13] RDMA/core: Add a helper API
 rdma_free_hw_stats_struct

On Thu, Sep 30, 2021 at 11:02:20AM +0300, Leon Romanovsky wrote:

> +
> +struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
> +	const struct rdma_stat_desc *descs, int num_counters,
> +	unsigned long lifespan)
> +{

The kdoc should be moved here too from the header

> +	struct rdma_hw_stats *stats;
> +
> +	stats = kzalloc(struct_size(stats, value, num_counters), GFP_KERNEL);
> +	if (!stats)
> +		return NULL;
> +
> +	stats->descs = descs;
> +	stats->num_counters = num_counters;
> +	stats->lifespan = msecs_to_jiffies(lifespan);
> +
> +	return stats;
> +}
> +EXPORT_SYMBOL(rdma_alloc_hw_stats_struct);
> +
> +void rdma_free_hw_stats_struct(struct rdma_hw_stats *stats)
> +{
> +	kfree(stats);
> +}
> +EXPORT_SYMBOL(rdma_free_hw_stats_struct);
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index aa1e1029b736..5e8a5ed47e9a 100644
> +++ b/include/rdma/ib_verbs.h
> @@ -589,24 +589,14 @@ struct rdma_hw_stats {
>   * @num_counters - How many elements in array
>   * @lifespan - How many milliseconds between updates
>   */
> -static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
> -		const struct rdma_stat_desc *descs, int num_counters,
> -		unsigned long lifespan)
> -{
> -	struct rdma_hw_stats *stats;
> -
> -	stats = kzalloc(sizeof(*stats) + num_counters * sizeof(u64),
> -			GFP_KERNEL);
> -	if (!stats)
> -		return NULL;
> -
> -	stats->descs = descs;
> -	stats->num_counters = num_counters;
> -	stats->lifespan = msecs_to_jiffies(lifespan);
> -
> -	return stats;
> -}
> +struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
> +	const struct rdma_stat_desc *descs, int num_counters,
> +	unsigned long lifespan);
>  
> +/**
> + * rdma_free_hw_stats_struct - Helper function to release rdma_hw_stats
> + */
> +void rdma_free_hw_stats_struct(struct rdma_hw_stats *stats);

Ditto

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ