From 87177ce3aa981ab2af40fd26c68481430d0867a4 Mon Sep 17 00:00:00 2001 From: Doug Moore Date: Mon, 24 Jun 2024 02:20:49 -0500 Subject: [PATCH] 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)