🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10557

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

#10557
From: Linus Walleij
Date: Tue, 03 Nov 2026 17:51
69 lines
9936 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 be2b9702718f..5e89057bb2fb 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>
@@ -475,6 +477,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);
@@ -543,7 +556,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: <20261103-gemini-ethernet-fixes-3-v6-13-c4b5ff8a65d8@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-355894-linux-kernel-netdev=dewy.ru
References: <20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@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-355894-linux-kernel-netdev=dewy.ru
From: linusw@kernel.org (Linus Walleij)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v6 13/15] net: ethernet: cortina: Scale Gemini RX
 queues to system memory
Date: Tue, 03 Nov 2026 18:51:24 +0100
Organization: Usenet Network
Message-ID: <20261103-gemini-ethernet-fixes-3-v6-13-c4b5ff8a65d8@kernel.org>
References: <20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3224616"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:k1aukWtRr2WgD0XmmPtMp9a6acw= sha256:WFem6FyOB8818hB941Lasy59tOTbGdJXzKjpTv24zqg=
	sha1:8pMMzKBqfPqOu9yP5xOLiPzZaB0= sha256:hgLUG4GI4a+oJisnwxR8D40lVw7uvYvJYOalioEkAqU=
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 8A699112987; Tue,  3 Nov 2026 20:53:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, 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 ndRK00MqojRJ;
	Tue,  3 Nov 2026 20:53:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355894-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 30DA9112956; Tue,  3 Nov 2026 20:53:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id A2BEB60738D; Tue,  3 Nov 2026 17:52:10 +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=1793728314;
	b=iwk+vSJPnv5nmqvezrdl4P3hZFy14ekRNf+R7Z/mXzPFpolg4Ip4+12xJWcYwHoFi3iQ
	 kIduWl1IfjiaBvaTJYVuqS5cwHsf/v+q+PlbfZWpfDIOc/OicQSyofsmwA8dwRlaWhCZx
	 bw/n0iTSwtNnzcrclmXND927w8VfXNJsAozBhvbThaEDEcFykobjxJ9rshzI7C6uwCLdk
	 ebuhB5XDBI7vIg3/+uQPdoucii6loyPe21P1M6s5RswX5/2Cbf+Nb7lMxAFeVIaoEYSOt
	 dMFbEX9GkhvqT5brMtbExTEdm+47DsTVZq5Gpt4cFHEcg9iM1GChakGpQDgSp8PMDtw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793728314;
	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=6zygdu4+s+H8IHTAOxJX/6tUTRs5gkoVuBjqjt5zcl4=;
	b=yViXkzFant4R/Jo6tThn8VRMO8CNKLF92bAUwtb+jqF5qd3+QHEyGfp+oix28ZtAroxp
	 V69zH2+/f5ID/Y+QIkpLjJyEZg7DZQooVieJhoRVFJtzF1stSUDFD2gNsBUETDFiWcRtA
	 k5eeBlLqJSIHRrHviqrF872/KS3xrzKuTE01ktzmtm8oAc0cYD74z6HbT99AYv682jNlY
	 UqwtGfPeVi29nKn3K/J3aJuxlaJT8bxKrKVSusjribVHT6JrPv9B3/sTMnELALQYh8D3K
	 J2X5T0u6axacuwifpoabvHWlwzyWibd7IMq6VlBQFtar5vty9GPZAYgaE7XIaBiM73g==
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=XCJo+VSJ;
	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 CF2F0606D813;
	Tue,  3 Nov 2026 17:51:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XCJo+VSJ
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=1793728314;
	b=ZDVDBBFn73nRoAHGenNl9gE2CbyZHXZwS+4ytP7hqUrKzvkTrf7YxM2m5kayEBncpSMP
	 8Riz6PZg+XLqAXg3gqNNJXcAfo/sAG6hZ3mjy20vAY3ouIC3xzA88AXmwPYIz40e4JajH
	 FiFAyLmF/fVDwPCI6de/oJTyHur3QnU83HOSwPrnYiGaiv3uBbfz0drBJ4zlCnJwDoTF5
	 3bRHnwHZcCGOiQTK6tbUf/vsJ4iBVCj1Tv5EDm40JVFMfEq75OdBCuSdb4uqe7IvkIO0I
	 /LxgzkQcYaipNdzOlKhGn3aZkXLd98nRDdS5n5e8cuHcQOBqN2dyqquvQ5F50tPUgnw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793728314;
	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=6zygdu4+s+H8IHTAOxJX/6tUTRs5gkoVuBjqjt5zcl4=;
	b=Xya39MA17KpvqB7y+4JGVxsiP3KG9G2AnVOJ+QQOwM4wg9Q2JXT9oTxpZ12AI3UHpAWo
	 2wp20pMqz61PEWXUBkO5swvX8T2LtIK8/7YzNDdB3n+svt8lFnEhTcO6kpWkazeaPZg1u
	 lMPe0DhplYvsP/BNO8JP7hyng8TZ+XS6A6J0YIMFZx9+lS9aDX/SNQwNt9X7y1B2SepOl
	 r0j3yNSX8N8zS7txOM6vTslFaEyEQhY+NICn46O8S2pSMrFUbPeJyF9aO8FXfVyk/+OsF
	 hex7uUlWCjpNfukkx11/AcuLmWJnu/aLIqLTWUjo5Wp2B6tcYMnCX6LSmD2Svxmzv3w==
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=XCJo+VSJ;
	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 AFFE7606A31B
	for <netdev@vger.kernel.org>; Tue,  3 Nov 2026 17:51:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 070031F00A02;
	Tue,  3 Nov 2026 17:51:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793728313;
	bh=6zygdu4+s+H8IHTAOxJX/6tUTRs5gkoVuBjqjt5zcl4=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=XCJo+VSJbruGormxbY2k6ZG+mpcW03oHatgJs+uSrE9y5/bA3dSqDwu3ihN/W+CgA
	 /WISEu+hEnh0/w6ulB47avvCXRGK8yhF3EauKiv652+0MGTlmC6NVr93vPFzU9yRBI
	 fFVVrorjc6JVvcZbAMMXb3uTGDpUDtSEjSBGcDU3+Xf76ZBaSvNjQyHk+prBoVzpyt
	 Lhh16anXyTaJjBqEP7cfMAimjnleotsFZHB2aytGuX1guQJUtbsMDElQ0WSyWBIE/8
	 w2fpGlRwWVew19+NSnmLjlNjZjRla8sztfU6K1mJzvkomdfoKcCbHAd5uX62XWdw4u
	 XSkxqYG6Gvrbw==
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: <20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@kernel.org>
X-Cc: netdev@vger.kernel.org, Linus Walleij <linusw@kernel.org>
X-Mailer: b4 0.16.0