From mboxrd@z Thu Jan 1 00:00:00 1970 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 EDDFF53ECED for ; Thu, 15 Oct 2026 15:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792077889; cv=none; b=HRsZx3KyqfwmxVNEeXGTGrW1YNf9MU6AftonTSKN2SENIo7eA3xAiVjF8on3lEDsihEY1RamIeSnS36Scv1NTsy6M8lpANwhetop8oO5DRVpBgkvmjq8jxLKnKW0jDt2lWlxOA77mAdA+r5B0tofpgSP+v06/FALzn5tkQs7Xd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792077889; c=relaxed/simple; bh=y/6rBOCzidNtL/IdgW9depdWp+u75Us6WBRIipNqvdE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZK+6bCG0O9slydhGQ6EcDRGkQrt/eGdfE4fgAO25JjjFVqAy6e3O/5FYbBDx6JTYferBley605KeO8bmbFm+xoqoxIQShwQ3ehyF5d3osKKhIa0ZLN+65OFuBriWpykFrrjmVaWgqKRIEwy7ZiQ9llhotHffYyZwbSwCP8mx0xE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LccbvJlo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LccbvJlo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FB161F000C5; Thu, 15 Oct 2026 15:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792077883; bh=loiDEt/MvVRA+ggLNb0penwvi1Srz31mMbhfGUUEppg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=LccbvJloBiZgxLL/mjIV/tWr7mCSisf2O832JSF+nNsgPVfWbh8t7dyaeH9aQWWDu SlTex59CW8/624/Ht6pk9HxFS2lZ6YncqjPwkltNeB+g7Ky1vLp4wqhPLX0/QISHBf mOeD0Lw3miXaSjP3+X+ueFTzLpZXESdDnqKpTnoZ7Rmd/omvXnlr9QsSqHQi62J4ZM HLh3Eih/LpKW7zNQwRRnaEloHt2lNUS8nwwrycS/BiUkke9xHd8tZzb67bp6C3VR9b uJf+VV1zGXzZtdHT6rS/HGccRJCBhaw09CrRrXj+tqZiQNERy5kbytUBafhq0IQDM5 yq6s0qPJW/31Q== From: Linus Walleij Date: Thu, 15 Oct 2026 17:24:13 +0200 Subject: [PATCH net-next v5 13/14] net: ethernet: cortina: Scale Gemini RX queues to system memory Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261015-gemini-ethernet-fixes-3-v5-13-b5c9e2f7b8a3@kernel.org> References: <20261015-gemini-ethernet-fixes-3-v5-0-b5c9e2f7b8a3@kernel.org> In-Reply-To: <20261015-gemini-ethernet-fixes-3-v5-0-b5c9e2f7b8a3@kernel.org> To: Hans Ulli Kroll , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni , =?utf-8?q?Micha=C5=82_Miros=C5=82aw?= , Myeonghun Pak , Eric Dumazet Cc: netdev@vger.kernel.org, Linus Walleij X-Mailer: b4 0.16.0 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 --- 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 843423187f8d..0c6c7c938b2e 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -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