From nobody Sat Sep 28 17:01:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XGDBl5vXtz5XbKM; Sat, 28 Sep 2024 17:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XGDBl5N5Yz4rMW; Sat, 28 Sep 2024 17:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727542895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UCbmwcwPXuiwXGlD1/n+qTMQ4bYNMm1tzu1mNH8g2vM=; b=vHQfa1NjVjosmBm2tpeLJVOqC1TncXXs0X8JumyuEu8+sHdRnD2Kl+SXQY8FfLBGk9YSIa uhL/o3ie7GTAjL+ABr+QQKApR66vuxjF3K5r/642g45c6pd6Kf12nxa+zRjZxrd6eQFpwZ 8sD14d4lg2Zlc+tbikXpFX0fbClF0exreWZZmisFMMxZdU5a5qXC82MpIdJye2AG1dfg4J fooUwrThEwyNSKDMIoKQ2uuQFRfaceewQz/GsrUiJRoN09jXNrVBO9kUilmjqL5eGZ2r4q lECnsAD35AK6SH6IgC20600gmq59oVN/skz5GKwh3YI/xpfWfuKMRcHTEBuuVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727542895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UCbmwcwPXuiwXGlD1/n+qTMQ4bYNMm1tzu1mNH8g2vM=; b=Y5Oq48iRgxjykFf4kJJZvrwMdO15Il2FOmUNyHVfLv4fTXBB4S+ICQlYfxABYD+7gzWVKr UnZRmI0HR0O6s5dlJ6mcIrIc6bGJ1A+C/mIC//6GsxpmwxUdJWL1OsZ6yVIS+7usQQNipK ifawHkuRbT/E3aWaJMVViL3BsSd5bj15+qwsik5skv71+VA70qsbm0vVzB+6MnJU5gOFI8 KGaldHEr/Yh6lgEv44mdjuitSTkR5TTDCg3INmtsLOdGIvTne+8+1yl43NRFEjK8xN4Q8P 87hVwXvNPDl/UycHjrs7XcvfnZg01wK+3Zmuw3b09xy8QQXAwt1tjLBAMuckzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727542895; a=rsa-sha256; cv=none; b=Erb10kCi2UvliiKOI2ClRJ6hPQY77aDmoYtlNh1HHARJPCwTwqlkD0jYUx7Rhw+mPP7UAx SZQj9RD/K17CzAApyxNzjOUfDwjo49JjfIj8GOeZNsd95AiubvCqg/kesBA30hjcoF56dV q1dwP195Xd8n6e+ecRcGUSfFxwKmy66kK2gIin+JWhl11bJvtHh3Q9fpdbHoL+WEZFsg3j 4NlT3wuX6R8wJMGmYEWXHmmRxo7sYuhjSuhugg8uOVB8sChhWmQYZ1bgUlIC/0ubRYTy9n Pru5dYf8Uo1CUyH7jh0NFGj4bq+fqMG/cZ5hK89lFt+nss56MwVrzGGFTHdDEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XGDBl4zPjzYp8; Sat, 28 Sep 2024 17:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48SH1ZjR058454; Sat, 28 Sep 2024 17:01:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48SH1ZWm058451; Sat, 28 Sep 2024 17:01:35 GMT (envelope-from git) Date: Sat, 28 Sep 2024 17:01:35 GMT Message-Id: <202409281701.48SH1ZWm058451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: c44fbfdb5686 - main - roundup_pow_of_two: don't take the log of it List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c44fbfdb56862c4c8d2563483b4fff8f9a5a1d43 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=c44fbfdb56862c4c8d2563483b4fff8f9a5a1d43 commit c44fbfdb56862c4c8d2563483b4fff8f9a5a1d43 Author: Doug Moore AuthorDate: 2024-09-28 17:00:06 +0000 Commit: Doug Moore CommitDate: 2024-09-28 17:00:06 +0000 roundup_pow_of_two: don't take the log of it Based on the definitions, ilog2(roundup_pow_of_two(x)) == order_base_2(x). Replace the former with the latter in a few places to save a few calculations. Reviewed by: bz, kib Differential Revision: https://reviews.freebsd.org/D46827 --- sys/dev/mlx4/mlx4_en/en.h | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index a29b40ddaf10..838894f7b02f 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -232,7 +232,7 @@ enum cq_type { /* * Useful macros */ -#define ROUNDUP_LOG2(x) ilog2(roundup_pow_of_two(x)) +#define ROUNDUP_LOG2(x) order_base_2(x) #define XNOR(x, y) (!(x) == !(y)) #define ILLEGAL_MAC(addr) (addr == 0xffffffffffffULL || addr == 0x0) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 3cda28752592..b391946440b9 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -488,7 +488,7 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, MLX4_IB_QPT_PROXY_GSI | MLX4_IB_QPT_TUN_SMI_OWNER))) qp->sq.wqe_shift = ilog2(64); else - qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); + qp->sq.wqe_shift = order_base_2(s); for (;;) { qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); @@ -544,7 +544,7 @@ static int set_user_sq_size(struct mlx4_ib_dev *dev, /* Sanity check SQ size before proceeding */ if ((1 << ucmd->log_sq_bb_count) > dev->dev->caps.max_wqes || ucmd->log_sq_stride > - ilog2(roundup_pow_of_two(dev->dev->caps.max_sq_desc_sz)) || + order_base_2(dev->dev->caps.max_sq_desc_sz) || ucmd->log_sq_stride < MLX4_IB_MIN_SQ_STRIDE) return -EINVAL;