From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [180.246.144.41]) by gnuweeb.org (Postfix) with ESMTPSA id BE79080615; Sun, 21 Aug 2022 11:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1661081164; bh=XPEV/M90XZkVnJrwivAtqDWwIRLMZMzxGjIgoWMltes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ct5vrgGA0vuoIdhKRbM+i8M7adUYySxP7W/L724/O6jVuA0nI5zL2GnWDWXB8NiW7 FBAHvZeiWLlslMgxQbOJADKMzlOA6B4i4iuwQfptg2K7adJ5tUzPDhHheuHQc7OIPr QnYtPEKSrpvjq9kNTxhw9pXV7+5X1JUupHEeD9rpDdQ4hjcBfDwRMuRFNOI0oG/wQE pD3nvfnvt8I/OGZ43xY1rRBW4C2alBUToc51dHk6EKpI9uu3PfODIUC0vR1FJgNCWm iHuGyL78tJo9+4GjISv7k0RLE2qCX08Z4HXmVi0gEhkeIpYn5KwTt/wEs+bnQljaYw gin1R/EkBY16Q== From: Ammar Faizi To: Alviro Iskandar Setiawan Cc: Ammar Faizi , Muhammad Rizki , Kanna Scarlet , GNU/Weeb Mailing List Subject: [PATCH v1 21/22] chnet: ring: Bump max_entry to 2G Date: Sun, 21 Aug 2022 18:24:52 +0700 Message-Id: <20220821112453.3026255-22-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220821112453.3026255-1-ammarfaizi2@gnuweeb.org> References: <20220821112453.3026255-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Make it able to handle bigger ring size. I have tested this with 2G entry and it works fine. Didn't manage to test chnet though, only nop SQEs as I don't have that much memory to run chnet with 2G ring size. Signed-off-by: Ammar Faizi --- chnet/chnet_ring.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chnet/chnet_ring.cc b/chnet/chnet_ring.cc index b858421..031c100 100644 --- a/chnet/chnet_ring.cc +++ b/chnet/chnet_ring.cc @@ -11,13 +11,15 @@ using namespace std::chrono_literals; CNRing::CNRing(uint32_t entry) { + constexpr static uint32_t min_entry = 2U; + constexpr static uint32_t max_entry = 1024U * 1024U * 1024U * 2U; uint32_t sq_max; uint32_t cq_max; - if (entry < 2) - entry = 2; - if (entry > 1048576) - entry = 1048576; + if (entry < min_entry) + entry = min_entry; + if (entry > max_entry) + entry = max_entry; sq_max = 1; while (sq_max < entry) -- Ammar Faizi