🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #1984

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

#1984
From: Linus Walleij
Date: Sun, 11 Oct 2026 18:06
70 lines
7646 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.

Assisted-by: LLM
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 32291d4c3390..a61bace61ea4 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>
@@ -36,6 +37,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>
@@ -474,6 +476,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);
@@ -542,7 +555,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.0
Technical Details
Message-ID: <20261011-gemini-ethernet-fixes-3-v4-14-4b1631b08f5d@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344565-linux-kernel-netdev=dewy.ru
References: <20261011-gemini-ethernet-fixes-3-v4-0-4b1631b08f5d@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344565-linux-kernel-netdev=dewy.ru
From: linusw@kernel.org (Linus Walleij)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v4 14/15] net: ethernet: cortina: Scale Gemini RX
 queues to system memory
Date: Sun, 11 Oct 2026 20:06:27 +0200
Organization: Usenet Network
Message-ID: <20261011-gemini-ethernet-fixes-3-v4-14-4b1631b08f5d@kernel.org>
References: <20261011-gemini-ethernet-fixes-3-v4-0-4b1631b08f5d@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1591627"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:05exI6Bc21paBIR2fhis4AXn0Nk= sha256:Fo1pUKDzBlIjaDUyPban/eAY1Lz1t+P1nHqbr76PlNQ=
	sha1:ZNkTZHGYEV/kjvHZl+LxQfE40yY= sha256:rPlmRFHbYvYYBJt808zi9Nhijx4tQDCelWKgpZdKhNM=
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 BE07510FA41; Sun, 11 Oct 2026 21:09:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.341
X-Spam-Status: No, score=-1.341 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, 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 rZlJKktQxy3h;
	Sun, 11 Oct 2026 21:09:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-344565-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 786D010FA1D; Sun, 11 Oct 2026 21:09:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 451CC2D7DB; Sun, 11 Oct 2026 18:07:03 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A2334391E57;
	Sun, 11 Oct 2026 18:07:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CN+fU5BH"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F80A439F8A
	for <netdev@vger.kernel.org>; Sun, 11 Oct 2026 18:06:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791742020; cv=none; b=Yh3GeQHCZTMZcpageelXwbQ/eyG7agjQUhGXX9/a07s5Xhn17t3c5AJek381lH3X/aKhoJcXaRdDhVafqujtxSikhMjTHpCrhfkszpK2uarMGia5IvDAmGY6dug0rIWVYSmLwtnXyhdeqyX4E4u2U6fh3n35v6yXoOTEtLU3AhI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791742020; c=relaxed/simple;
	bh=Pc572/R0IvjpgVDMuvW6H8WBWj0GqpfyYDmDNYJ+aBQ=;
	h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
	 In-Reply-To:To:Cc; b=YSg3ZBMecPI9UPVadhiOMGjjQK1YeguPKEC2iL5+r6LZK40voWezHjmx3D4PE7XG7dK00ff2PWbz+YEnGWNmTSwTlBa2YxwMTjwsrkaN6gse/pICEkEtddNCztSj+kI0a2/JYJHOM7iQGTNyoPC6zjv8uQvhvAzIGvil2z+xXRY=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CN+fU5BH; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 083601F0089B;
	Sun, 11 Oct 2026 18:06:56 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791742019;
	bh=hsQo05VuFs1kzg0cifpZusOqpFBHENGhh0/jxgYT8pg=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=CN+fU5BHFagwefMS7rdE/eylsQNLBDAdQrsLil2UyEMCZD5TPFpJ/y4i8Coaw/c2N
	 LL7vMRTZ/z3APWGfWsPE9t09eDhey5Ec4ChpfWPbw7AlTKLf1HIcY5M4tYm9Da3Wwr
	 M4tUjuR9782c1lzAiiQXLQy4KU1jjFSk87fpotsezmvRhg95twl01WDDP4+w0eU7Mb
	 RNmy/7dzy6xKel9HmQavk0LpiYgMPREV3GNAuVzLi+0pSOdbD/VUVcNESddgK6mW5H
	 z/z/mMQn79XSteyAQuobMdYTHnVlCxrshGjSGSeCCqVHa6vR1iJGRFpYsvqJGZjCps
	 aO351LKAfk2bA==
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261011-gemini-ethernet-fixes-3-v4-0-4b1631b08f5d@kernel.org>
X-Cc: netdev@vger.kernel.org, Linus Walleij <linusw@kernel.org>
X-Mailer: b4 0.16.0