Article View: linux.kernel.netdev
Article #15209[PATCH net-next v8 14/19] net: ethernet: cortina: Scale Gemini RX queues to system memory
From: Linus Walleij
Date: Thu, 12 Nov 2026 13:30
Date: Thu, 12 Nov 2026 13:30
69 lines
9997 bytes
9997 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 0588e573f8da..5a87d88607cd 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.0
Technical Details
Message-ID:
<20261112-gemini-ethernet-fixes-3-v8-14-f55bd43e02d3@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361876-linux-kernel-netdev=dewy.ruReferences:
<20261112-gemini-ethernet-fixes-3-v8-0-f55bd43e02d3@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361876-linux-kernel-netdev=dewy.ru From: linusw@kernel.org (Linus Walleij) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v8 14/19] net: ethernet: cortina: Scale Gemini RX queues to system memory Date: Thu, 12 Nov 2026 14:30:29 +0100 Organization: Usenet Network Message-ID: <20261112-gemini-ethernet-fixes-3-v8-14-f55bd43e02d3@kernel.org> References: <20261112-gemini-ethernet-fixes-3-v8-0-f55bd43e02d3@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1105280"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:jL0qtuBBgd2KnmQaaGbzb1pdDKY= sha256:7yG8urxKtdOZt2b0ewmNapcbht+bQgHz3GdZpez0puQ= sha1:roeFECtM2K2K6m/FDNZiziD8cj0= sha256:tNoRynVZcd9P9ZUXnSzrv2YqWXNKbE5Y5lMBriYt7us= 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 B33B5114292; Thu, 12 Nov 2026 17:21:35 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 ImUl1-BQWz5C; Thu, 12 Nov 2026 17:21:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361876-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 79E4E114286; Thu, 12 Nov 2026 17:21:24 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 40C2E1A4375; Thu, 12 Nov 2026 13:31:31 +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=1794490260; b=11KIwaHkRlV8anm1JLy/fy33IE8sMOZfVAT6xWj3y1hoxWivj3RadAHDTmIwJgefj7Yg uP8pff1ADEL4sjD2teoTrEzBFKh8JGtqNpmqGvTWMGGSiRvxhrmAy6SDkONTCTqaIuDP1 lKx086TbUXo1hIffFJ3JJZjIfTVUx03SMlW/U9N3bGx0nZN/y/5sXQ2JkIosWlJdbsIOD x8FausNT9EYJsXZNSwObdBBUde24GvcXnWo9nwFhz9TwtKAjPtflfluvEwv9BU6pXu3n1 /vEEg8uBTzZI8Vj/ckALooTUnA53+29X4/QmzE/PSwF+xoj368DBYjirH7vOFQGALCw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794490260; 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=SEdSQLvUWPqt+hzMMG2djvmCgziXmwgOFfcsBO/Oktc=; b=hRMG+aE7S4uwfH72JJMpH3ERCSKoiomXCzoT/2AZOzjy0ExH5DmjSAG7Mljo5WvnwiAK iIGxYNreAKPwXViGgVxBa/WxieiMtTQYU9aOpkebun9rSgI1Z+DDudIGe9IWCtyWtlWTN kzRFMg0AoyucoogmmDD/Svr/tFw10B6VbMUwnB/PWlJ/YJ0UugIQwfpeqEddI7jAAp23v uUprp3+ifMBdK8xarr02kL0/8EpnS9xlh9yKkHPy26dCsU7Dkoz/97IOGR75GD9MzuMdn hSQBBXjmcZA7f2QK+ix82xFYb+fSdOZi37DjlBF1Zf4jQBArQW8cdBQPiEoQsEwd6Ig== 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=UjCdGdLD; 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 2469560A260F; Thu, 12 Nov 2026 13:31:00 +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=UjCdGdLD 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=1794490259; b=PUI66RK3ozEikhNzi26Zpx0uV+kRV0j6nPA6f52XcY5ZQFF8DQ+e8OLSewlx7Tvt75EE BevI1oxuKTcTNE83lHVgtH0L/hBJD6y49E824Wxz0Lu+I19w3e3AmV9idRTl2st1J4Eh+ iDnzVqXUW/jtEn2QwmLKSfvq7xLxqEZBOL5cvxwzlIxginVs0tJG4uDY9Kvu2TJAch5MF fxfnilQusx9B0z+nUTe5SPlS8jatnyu+LBMwBMbPiAWJ20zEKKsDFu3lxZqS+tWlhvgLL YFvYM/SMz9HHwYvZwxg6GXjQAJajz9/Ydxw6/NX3pb41LOADEqwK4eLgkICObKu9nvg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794490259; 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=SEdSQLvUWPqt+hzMMG2djvmCgziXmwgOFfcsBO/Oktc=; b=L6ZRt0AFZ+I1WVjLAB0J6qb4N+gBA/kJPUyzPr6V5ftWRtmRq1RvclorYVOe44bpDjZl sUiXOY+bv2UyzsDMIV5DAyKSCOk3edDcRIM62SzMRgmh53WRVstTpFNAzzQZ6Rj60OcNU YDbS2rb8+vf5BFFSrh5zQSAFPpLYGbn6rSOwRDXLGvnmdyaoVO2bmFQ2bdLXYdQTypFi4 wJYBRcyXDKAQUIV+CLD2BCVMiqFb+hRtHTDPbrMXjjfk5Ydx3n0PZ7LALyu3Awrw8nPvq 2DP0ib6mp5h2H7WKoV2JlUTNB2pwZyPRXq0C+S9BgQHsqpcFFobCczAhBaKya4ceGNw== 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=UjCdGdLD; 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 3E71A60A2607 for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 13:30:59 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB1B21F00A06; Thu, 12 Nov 2026 13:30:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794490259; bh=SEdSQLvUWPqt+hzMMG2djvmCgziXmwgOFfcsBO/Oktc=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=UjCdGdLDyL+8PRBjHP+jPN5T2URPZNrzqUsP/SOwJoFvBPg9TpD4XcObTEnlK4+14 x6G2TDBMA0v3S5859FOk2xQNsbahO7kFLCPPliNDa8F+reg+entWMN29slBD70JwaY MXf43Z1LlJA6gQakXYEwLfFWeCRIJo/dAu+Xm8VjJSMQAnvdhXSO7v+UYC+AsdSXX6 /3bmReT1TxXoyUXhFgBbDjoscSBcpCx2K7dj6mc1TzIE6xxFvJtOghSOjnuT6hiNZb xPJA2SZiDjOtugncxr0P3ehwu2t1l84I7F0wCQhxFhufckl+1lMsccoKNn4/NgRWZR yooSzQQtfF4Cg== 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: <20261112-gemini-ethernet-fixes-3-v8-0-f55bd43e02d3@kernel.org> X-Cc: netdev@vger.kernel.org, Linus Walleij <linusw@kernel.org> X-Mailer: b4 0.16.0 X-Received-Bytes: 9712