Netdev List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	mkalderon@marvell.com, zyjzyj2000@gmail.com, sagi@grimberg.me,
	mgurtovoy@nvidia.com, haris.iqbal@ionos.com,
	jinpu.wang@ionos.com, bvanassche@acm.org, kbusch@kernel.org,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	kch@nvidia.com, smfrench@gmail.com, linkinjeon@kernel.org,
	metze@samba.org, tom@talpey.com, cel@kernel.org,
	jlayton@kernel.org, neil@brown.name, okorniev@redhat.com,
	Dai.Ngo@oracle.com, trondmy@kernel.org, anna@kernel.org,
	achender@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	kees@kernel.org, michaelgur@nvidia.com, edwards@nvidia.com,
	phaddad@nvidia.com, eadavis@qq.com, yishaih@nvidia.com,
	kalesh-anakkur.purayil@broadcom.com, clm@meta.com,
	ebadger@purestorage.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, target-devel@vger.kernel.org,
	linux-nvme@lists.infradead.org, linux-cifs@vger.kernel.org,
	samba-technical@lists.samba.org, linux-nfs@vger.kernel.org,
	netdev@vger.kernel.org, rds-devel@oss.oracle.com,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v10 rdma-next] RDMA: Change capability fields in ib_device_attr from int to u32
Date: Thu, 9 Jul 2026 11:31:55 +0300	[thread overview]
Message-ID: <ak9ce4PaJ5n89zW9@ashevche-desk.local> (raw)
In-Reply-To: <20260709055211.2498307-1-ernis@linux.microsoft.com>

On Wed, Jul 08, 2026 at 10:51:29PM -0700, Erni Sri Satya Vennela wrote:
> The capability counter fields in struct ib_device_attr are declared
> as signed int, but these values are inherently non-negative. Drivers
> maintain their cached caps as u32 and assign them directly into these
> int fields; if a cap exceeds INT_MAX the implicit narrowing yields a
> negative value visible to the IB core.
> 
> Change the signed int capability fields to u32 to match the
> underlying nature of the data. Also update consumers across the IB
> core, ULPs, NVMe-oF target, RDS, and NFS/RDMA so the new u32 values
> are not forced back through signed int or u8 via min()/min_t() or
> narrowing local variables.
> 
> The nvmet-rdma consumer of max_srq clamps it against
> ib_device.num_comp_vectors, which stays a signed int, so that site
> uses min_t() instead of min() to handle the signed/unsigned mismatch.

Assuming the functionality is left untouched, from code perspective LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

>  int ipoib_cm_dev_init(struct net_device *dev)
>  {
>  	struct ipoib_dev_priv *priv = ipoib_priv(dev);
> -	int max_srq_sge, i;
> +	u32 max_srq_sge;
> +	int i;
>  	u8 addr;

This can keep the reversed xmas tree ordering.

...

>  static int srq_size_set(const char *val, const struct kernel_param *kp)
>  {
> -	int n = 0, ret;
> +	unsigned int n;
> +	int ret;
>  
> -	ret = kstrtoint(val, 10, &n);
> +	ret = kstrtouint(val, 10, &n);
>  	if (ret != 0 || n < 256)
>  		return -EINVAL;

Side note (perhaps another patch?)

	ret = kstrtouint(val, 10, &n);
	if (ret)
		return ret;
	if (n < 256)
		return -ERANGE,

> -	return param_set_int(val, kp);
> +	return param_set_uint(val, kp);
>  }

...

Have you considered also replacing min_not_zero() or do some refactoring
around there?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-07-09  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  5:51 [PATCH v10 rdma-next] RDMA: Change capability fields in ib_device_attr from int to u32 Erni Sri Satya Vennela
2026-07-09  8:31 ` Andy Shevchenko [this message]
2026-07-12  8:50 ` Leon Romanovsky
2026-07-12 11:26 ` 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=ak9ce4PaJ5n89zW9@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=achender@kernel.org \
    --cc=anna@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=cel@kernel.org \
    --cc=clm@meta.com \
    --cc=davem@davemloft.net \
    --cc=eadavis@qq.com \
    --cc=ebadger@purestorage.com \
    --cc=edumazet@google.com \
    --cc=edwards@nvidia.com \
    --cc=ernis@linux.microsoft.com \
    --cc=haris.iqbal@ionos.com \
    --cc=hch@lst.de \
    --cc=horms@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@ionos.com \
    --cc=jlayton@kernel.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=michaelgur@nvidia.com \
    --cc=mkalderon@marvell.com \
    --cc=neil@brown.name \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=phaddad@nvidia.com \
    --cc=rds-devel@oss.oracle.com \
    --cc=sagi@grimberg.me \
    --cc=samba-technical@lists.samba.org \
    --cc=smfrench@gmail.com \
    --cc=target-devel@vger.kernel.org \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    --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