Re: [PATCH rdma-next v9] RDMA: Change capability fields in ib_device_attr from int to u32
From: Erni Sri Satya Vennela <hidden>
Date: 2026-07-08 07:35:30
Also in:
linux-cifs, linux-nfs, linux-nvme, linux-rdma, lkml, target-devel
quoted
I originally left max_srq as int because its only consumer pairs it with num_comp_vectors (a signed int) in nvmet_rdma, so keeping it int let that site stay a plain min() instead of a min_t(). num_comp_vectors is the completion-vector count, legitimately int and never anywhere near INT_MAX, so I'd prefer to leave it signed rather than convert it everywhere. Does that work for you, or would you rather num_comp_vectors be converted too?In this patch no, but it is worth to write this in commit message. Thanks
Thanks for the confirmation, Leon. I'll use min_t for max_srq and document it in the commit message. - Vennela
quoted
If it needs converting, I'll do it as a separate patch, since it lives in a different struct (ib_device) and touches many call sites. Otherwise, using min_t() for just this one call is fine too. Thanks, Vennelaquoted
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index f599c24b34e8..aae4f3f6bcba 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c@@ -454,7 +454,8 @@ static int fill_res_info(struct sk_buff *msg, struct ib_device *device, }; struct nlattr *table_attr; - int ret, i, curr, max; + u64 curr, max; + int ret, i; if (fill_nldev_handle(msg, device)) return -EMSGSIZE;diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c index cfee2071586c..1b2f9df49e28 100644 --- a/drivers/infiniband/core/restrack.c +++ b/drivers/infiniband/core/restrack.c@@ -61,7 +61,7 @@ void rdma_restrack_clean(struct ib_device *dev) * @type: actual type of object to operate * @show_details: count driver specific objects */ -int rdma_restrack_count(struct ib_device *dev, enum rdma_restrack_type type, +u32 rdma_restrack_count(struct ib_device *dev, enum rdma_restrack_type type, bool show_details) { struct rdma_restrack_root *rt = &dev->res[type];diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h index 451f99e3717d..c081384740ce 100644 --- a/include/rdma/restrack.h +++ b/include/rdma/restrack.h@@ -123,7 +123,7 @@ struct rdma_restrack_entry { u32 id; }; -int rdma_restrack_count(struct ib_device *dev, enum rdma_restrack_type type, +u32 rdma_restrack_count(struct ib_device *dev, enum rdma_restrack_type type, bool show_details); /** * rdma_is_kernel_res() - check the owner of resource