Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org
Subject: [RFC PATCH v2 1/5] RDMA/mthca: Make the direct buffer size limits macros
Date: Wed,  2 Dec 2026 03:17:37 +0000	[thread overview]
Message-ID: <20261202032044.1705331-2-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261202032044.1705331-1-ericcurtin17@gmail.com>

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant, so it cannot initialise an enumerator.

Convert MTHCA_MAX_DIRECT_CQ_SIZE, MTHCA_MAX_DIRECT_QP_SIZE and
MTHCA_MAX_DIRECT_SRQ_SIZE from enum members to macros of 4 * PAGE_SIZE.
They are only used as arguments to mthca_buf_alloc(), so they can be
evaluated at run time.

No functional change.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/hw/mthca/mthca_cq.c  | 4 +---
 drivers/infiniband/hw/mthca/mthca_qp.c  | 3 ++-
 drivers/infiniband/hw/mthca/mthca_srq.c | 4 +---
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 39d4ff15849e..0dc018319340 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -46,9 +46,7 @@
 #include "mthca_cmd.h"
 #include "mthca_memfree.h"
 
-enum {
-	MTHCA_MAX_DIRECT_CQ_SIZE = 4 * PAGE_SIZE
-};
+#define MTHCA_MAX_DIRECT_CQ_SIZE (4 * PAGE_SIZE)
 
 enum {
 	MTHCA_CQ_ENTRY_SIZE = 0x20
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 53f43649f7d0..c0578ae29ef3 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -49,8 +49,9 @@
 #include "mthca_memfree.h"
 #include "mthca_wqe.h"
 
+#define MTHCA_MAX_DIRECT_QP_SIZE (4 * PAGE_SIZE)
+
 enum {
-	MTHCA_MAX_DIRECT_QP_SIZE = 4 * PAGE_SIZE,
 	MTHCA_ACK_REQ_FREQ       = 10,
 	MTHCA_FLIGHT_LIMIT       = 9,
 	MTHCA_UD_HEADER_SIZE     = 72, /* largest UD header possible */
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index a85935ccce88..f2e52f410c46 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -43,9 +43,7 @@
 #include "mthca_memfree.h"
 #include "mthca_wqe.h"
 
-enum {
-	MTHCA_MAX_DIRECT_SRQ_SIZE = 4 * PAGE_SIZE
-};
+#define MTHCA_MAX_DIRECT_SRQ_SIZE (4 * PAGE_SIZE)
 
 struct mthca_tavor_srq_context {
 	__be64 wqe_base_ds;	/* low 6 bits is descriptor size */

       reply	other threads:[~2026-12-02  3:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
2026-12-02  3:17 ` Eric Curtin [this message]
2026-12-02  3:17 ` [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks Eric Curtin
2026-12-02  3:28   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX Eric Curtin
2026-12-02  3:29   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN Eric Curtin
2026-12-02  3:31   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs Eric Curtin
2026-12-02  3:36   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202032044.1705331-2-ericcurtin17@gmail.com \
    --to=ericcurtin17@gmail.com \
    --cc=eric.curtin@docker.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox