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: <20211004180124.GC2515663@nvidia.com>
Date:   Mon, 4 Oct 2021 15:01:24 -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>,
        Neta Ostrovsky <netao@...dia.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 06/13] RDMA/counter: Add optional counter
 support

On Thu, Sep 30, 2021 at 11:02:22AM +0300, Leon Romanovsky wrote:
> diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
> index 331cd29f0d61..dac8f370ae3c 100644
> +++ b/drivers/infiniband/core/counters.c
> @@ -106,6 +106,36 @@ static int __rdma_counter_bind_qp(struct rdma_counter *counter,
>  	return ret;
>  }
>  
> +int rdma_counter_modify(struct ib_device *dev, u32 port,
> +			unsigned int index, bool enable)
> +{
> +	struct rdma_hw_stats *stats;
> +	int ret = 0;
> +
> +	if (!dev->ops.modify_hw_stat)
> +		return -EOPNOTSUPP;
> +
> +	stats = ib_get_hw_stats_port(dev, port);
> +	if (!stats || (index >= stats->num_counters) ||
> +	    !(stats->descs[index].flags & IB_STAT_FLAG_OPTIONAL))
> +		return -EINVAL;
> +
> +	mutex_lock(&stats->lock);
> +
> +	if (enable != test_bit(index, stats->is_disabled))
> +		goto out;
> +
> +	ret = dev->ops.modify_hw_stat(dev, port, index, enable);
> +	if (ret)
> +		goto out;
> +
> +	enable ? clear_bit(index, stats->is_disabled) :
> +		set_bit(index, stats->is_disabled);

This still needs to follow the kernel standard..

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ