Re: [PATCH rdma-next v6] RDMA: Change capability fields in ib_device_attr from int to u32

Erni Sri Satya Vennela <[email protected]>
Newsgroups gmane.linux.network,gmane.linux.drivers.rdma,gmane.linux.kernel,gmane.linux.scsi.target.devel,gmane.linux.kernel.cifs,gmane.network.samba.internals,gmane.linux.nfs
Message-ID <aiPFuqrpy0gJQB73@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
On Tue, Jun 02, 2026 at 12:33:27PM +0100, David Laight wrote:
 > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > index 6482ad859bd1..852213365ecd 100644
> > --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > @@ -1731,7 +1731,7 @@ static int create_con(struct rtrs_srv_path *srv_path,
> >  		 * All receive and all send (each requiring invalidate)
> >  		 * + 2 for drain and heartbeat
> >  		 */
> > -		max_send_wr = min_t(int, wr_limit,
> > +		max_send_wr = min_t(u32, wr_limit,
> >  				    SERVICE_CON_QUEUE_DEPTH * 2 + 2);
> 
> That should compile as min().
> (The constant is known to be non-negative.)

Okay, I'll update this in the next version.
> 
> ...
> > diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
> > index e6e2c3f9afdf..fd6923198ec1 100644
> > --- a/drivers/nvme/target/rdma.c
> > +++ b/drivers/nvme/target/rdma.c
> ...
> > @@ -1553,8 +1554,8 @@ static int nvmet_rdma_cm_accept(struct rdma_cm_id *cm_id,
> >  
> >  	param.rnr_retry_count = 7;
> >  	param.flow_control = 1;
> > -	param.initiator_depth = min_t(u8, p->initiator_depth,
> > -		queue->dev->device->attrs.max_qp_init_rd_atom);
> > +	param.initiator_depth = (u8)min_t(u32, p->initiator_depth,
> > +		min_t(u32, U8_MAX, queue->dev->device->attrs.max_qp_init_rd_atom));
> 
> I think you've change one of those to min_3().
> Nesting min() is a good way to bloat the pre-processor output.
> You don't need any of the casts.
> 	
> 	param.initiator_depth = min_3(p->initiator_depth,
> 		queue->dev->device->attrs.max_qp_init_rd_atom, U8_MAX);
> should be fine - if a bit long.
> 
> There are also (u32)U8_MAX casts lurking - pointless.
> 
Okay. I'll use min3 as suggested in the next version and remove
unneccesary casts.

Thanks,
Vennela
> -- David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.