git: 87177ce3aa98 - main - irdma: Use round{up,down}_pow_of_two

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Mon, 24 Jun 2024 07:27:56 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=87177ce3aa981ab2af40fd26c68481430d0867a4

commit 87177ce3aa981ab2af40fd26c68481430d0867a4
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-24 07:20:49 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-24 07:20:49 +0000

    irdma: Use round{up,down}_pow_of_two
    
    Use roundup_pow_of_two and rounddown_pow_of_two in place of expressions.
    
    Reviewed by:    alc, markj
    Differential Revision:  https://reviews.freebsd.org/D45536
---
 sys/dev/irdma/irdma_ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/irdma/irdma_ctrl.c b/sys/dev/irdma/irdma_ctrl.c
index 6078ac43815e..79ed14a60670 100644
--- a/sys/dev/irdma/irdma_ctrl.c
+++ b/sys/dev/irdma/irdma_ctrl.c
@@ -4939,7 +4939,7 @@ irdma_cfg_fpm_val(struct irdma_sc_dev *dev, u32 qp_count)
 
 	qpwanted = min(qp_count, hmc_info->hmc_obj[IRDMA_HMC_IW_QP].max_cnt);
 	if (qpwanted != 0)
-		qpwanted = 1 << ilog2(qpwanted);
+		qpwanted = rounddown_pow_of_two(qpwanted);
 
 	mrwanted = hmc_info->hmc_obj[IRDMA_HMC_IW_MR].max_cnt;
 	pblewanted = hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE].max_cnt;
@@ -4982,7 +4982,7 @@ irdma_cfg_fpm_val(struct irdma_sc_dev *dev, u32 qp_count)
 		hmc_info->hmc_obj[IRDMA_HMC_IW_MR].cnt = mrwanted;
 
 		hte = round_up(qpwanted + hmc_info->hmc_obj[IRDMA_HMC_IW_FSIMC].cnt, 512);
-		hte = hte == 0 ? 1 : 1 << fls(hte - 1);
+		hte = roundup_pow_of_two(hte);
 		hmc_info->hmc_obj[IRDMA_HMC_IW_HTE].cnt =
 		    hte * hmc_fpm_misc->ht_multiplier;
 		if (dev->hw_attrs.uk_attrs.hw_rev == IRDMA_GEN_1)