🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27520

[PATCH net-next v10 14/14] net: ethernet: cortina: Scale Gemini RX queues to system memory

#27520
From: Linus Walleij
Date: Sat, 05 Dec 2026 21:46
69 lines
9916 bytes
The default RX queues contain 512 descriptors per port. The shared
software free queue is sized at twice their combined capacity, requiring
4 MiB of page fragments even on Gemini systems with only 32 or 64 MiB of
RAM.

Choose smaller default RX queues on memory-constrained systems. Use 256
descriptors per port and a 2 MiB free queue with at most 64 MiB of RAM,
and 128 descriptors per port with a 1 MiB free queue with at most 32 MiB.
Keep the existing defaults on systems with more memory.

This preserves the existing relationship between RX descriptor capacity
and the free queue. Users can still override the defaults with ethtool.

Signed-off-by: Linus Walleij <linusw@kernel.org>
---
 drivers/net/ethernet/cortina/gemini.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index dc6e36ebadde..8feff00630eb 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/bitmap.h>
 #include <linux/init.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/platform_device.h>
@@ -37,6 +38,7 @@
 #include <linux/skbuff.h>
 #include <linux/phy.h>
 #include <linux/crc32.h>
+#include <linux/sizes.h>
 #include <linux/ethtool.h>
 #include <linux/tcp.h>
 #include <linux/u64_stats_sync.h>
@@ -509,6 +511,17 @@ static int gmac_pick_rx_max_len(unsigned int max_l3_len)
 	return -1;
 }
 
+static unsigned int gmac_pick_rxq_order(void)
+{
+	if (totalram_pages() <= (SZ_32M >> PAGE_SHIFT))
+		return DEFAULT_GMAC_RXQ_ORDER - 2;
+
+	if (totalram_pages() <= (SZ_64M >> PAGE_SHIFT))
+		return DEFAULT_GMAC_RXQ_ORDER - 1;
+
+	return DEFAULT_GMAC_RXQ_ORDER;
+}
+
 static int gmac_init(struct net_device *netdev)
 {
 	struct gemini_ethernet_port *port = netdev_priv(netdev);
@@ -577,7 +590,7 @@ static int gmac_init(struct net_device *netdev)
 	writel(sw_weigh.bits32,
 	       port->dma_base + GMAC_TX_WEIGHTING_CTRL_1_REG);
 
-	port->rxq_order = DEFAULT_GMAC_RXQ_ORDER;
+	port->rxq_order = gmac_pick_rxq_order();
 	port->txq_order = DEFAULT_GMAC_TXQ_ORDER;
 	port->rx_coalesce_nsecs = DEFAULT_RX_COALESCE_NSECS;
 

-- 
2.56.1
Technical Details
Message-ID: <20261205-gemini-ethernet-fixes-3-v10-14-9edd2057429c@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378149-linux-kernel-netdev=dewy.ru
References: <20261205-gemini-ethernet-fixes-3-v10-0-9edd2057429c@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378149-linux-kernel-netdev=dewy.ru
From: linusw@kernel.org (Linus Walleij)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v10 14/14] net: ethernet: cortina: Scale Gemini RX
 queues to system memory
Date: Sat, 05 Dec 2026 22:46:57 +0100
Organization: Usenet Network
Message-ID: <20261205-gemini-ethernet-fixes-3-v10-14-9edd2057429c@kernel.org>
References: <20261205-gemini-ethernet-fixes-3-v10-0-9edd2057429c@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3126483"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:40Cp13ltxWQLMGIPBM23YmRTYHo= sha256:aIqvvPiqHivSE4FHDXXL9bkmCHUyPmY/5n4OecyFyEo=
	sha1:OcuHiAkfJX3n4BmWEF8n30tX38o= sha256:dJogyAhZSsfzb4HMMk/R0cMUdYOzVJy7U6sv5rOrnt0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 1EBC7117EBC; Sun,  6 Dec 2026 00:47:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id H6LWs5JGWq09;
	Sun,  6 Dec 2026 00:47:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-378149-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id E444E117EBF; Sun,  6 Dec 2026 00:47:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CF1A222BB0; Sat,  5 Dec 2026 21:47:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796507253;
	b=UuluB37BdDAjrnstmjgzjaZOLkIDTA+kLXsQP6q+xOczMBOB+z4PJivsbqeUnDm9Xyvc
	 BWr4NntbqsmqyvUKj5H+1hkTzT7PZ64Ws0JDn5CXUKlqN8C4rfBXrvQ40GbmMIdh9iCZJ
	 TDjTVYu+lsL4d10Ng1k3kaBWcLEJ3XwjNTtAtC0u9SNs4vDd9Xk42vS+1nX6tMbQZCHJb
	 ycrOGOR8EZJP8hcsfSqVEqAhRXl4k4HPvLkV7Ef2/ZAdYPTT61j5ReqrXYd2AL9I/1JPa
	 KUo395c3veT1CDCIY76W0dEnBwVe7nEG+7GawBgJ14PLBc/XJb8PrXjAIdjK3CnN0Kg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796507253;
	h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer;
	bh=f+nDRWF4QzGaFZokgWBOCVSCXCkfpwkJ+a7w84ENLMA=;
	b=QItzSVuanUX2fsGf5PFf6dSbWg6+Gfm8PRXfTsGT5mKeqUE8BU+YBT9W/knM6lr5n+YB
	 irmrSZT91xuKONA1tFiESTqBVrh9vhpG5LCQjfJKaqNKx7pldExM+sbysosLo3oBLwxaW
	 Ed3G52SnjP00Ze4fRya7T1j+4W+CY66N1Kou6KiRgBxDVwKuG6vAaky96sHRfpQUv5Try
	 wTrYhlm7r4AO8CrYf5SBsB6QCgo8T6Yo4rR5WsK+qVt/s6RuSyJp/B/VkS95Ggwge49QK
	 LycbtgDdFwz2OulMVkPJcrmCk0ShTHoMpQbq5/ds/ujGObXoDGGGUB3m88qF0Zfzt4g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WBltmCHh;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 00184606A334;
	Sat,  5 Dec 2026 21:47:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WBltmCHh
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796507252;
	b=sXXDs1n1h6PdR3XiYm5zJcgMsQfmlUKCh6pc7QDv4ildQ3/E1EjTCoKAwCvyUNJ1qFpC
	 nBiUYZ3IYSgTBhv2UpL0jEn+lz66z2z36+zmZqVKYEAbLciZez8CBWtPZF8lHyo4jCkBS
	 LVrRCTCBIC3LZxeUjzN+ZeuwNFBH2ZYTlSOfShjhX8kcsasD8nBfAfoirTPcEOX1iXNDF
	 dreuT7BVIYnYgV3oSWplfdcPt/TyrsWD0iEP7qBle0xRzL3k6ahavyaap+8pGFiYETbBl
	 4srTjsrZFpgC1qTOlC7J6RuStKUrbXSAbSjE8SFNUHd2h19IoioEbLV4l91SvhGpU1g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796507252;
	h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer;
	bh=f+nDRWF4QzGaFZokgWBOCVSCXCkfpwkJ+a7w84ENLMA=;
	b=2z4ejcFpujCM4ifUHvElWE5rzf6rb2zooH1NJihDFR44uqiL/ixVOBNIL1x7b5i4njuN
	 hqarTpQyV1+RTZFb5wkZCWIyFQ86j/vU3qvynvJ1TulMaKj/vqERvkQSTm12BqgZBbZzL
	 dw1zg3hQlm7xHu2salar187E/Wat6rNNhX+2vG1d7iF9gUKMKLMNnA+48MQK2+vOedcyC
	 fL6FvwWxjMVNp9FLEfQmNo8k2mBh9R3+QlVotknzk8bj/XjsvIzlq9Y+qPkw/sho9u4Ka
	 capMM8AN0YRLeedAK9GGqcDHo+XHXN8kxUZP50+cEK35DOdd/m5dfOXCd148V3YE89Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WBltmCHh;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B44A606A32F
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 21:47:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2187E1F0092B;
	Sat,  5 Dec 2026 21:47:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796507251;
	bh=f+nDRWF4QzGaFZokgWBOCVSCXCkfpwkJ+a7w84ENLMA=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=WBltmCHhi/vgDqWjkbjuFUgn20UWoQevA4s2YHvCHQ47eGHtkWDIgHNwndBPw/PTE
	 XEWs0M0KWFju3vYWo7QCFpMUE8qsAMUrGBSx+NxpQf84C3JBaLjjorjrVofv+fXRsJ
	 xNcO55NPmBUZ+TCyM0FOdEIVdhkUsD1hJz1RQBnxmbtkFUNUGummex0esazt/DJHaK
	 37uMsnejTfWXiJudYP4PD06UN3uzXXlPq15KLMovlj8pGSsvTSPwqpnj3LGlOd5fK5
	 0YnoClUj44oMIO+K4gG9KCuksrBmxtAxZSAwf6yILmcH9SMUAzwadAFS54AHCNoyzo
	 TtJqUIhVUIubg==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261205-gemini-ethernet-fixes-3-v10-0-9edd2057429c@kernel.org>
X-Cc: netdev@vger.kernel.org, Linus Walleij <linusw@kernel.org>
X-Mailer: b4 0.16.0