From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 50C4A3451B5 for ; Tue, 10 Mar 2026 09:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773135784; cv=none; b=hVy/W/KtDJCpGh3ygTfMfYBVOWsQw4H82t+4nuXXCP9RBttcr0rjsO/jWJp/2uqv8LVaHGTw2dh35rCv2DDn70RxbqRPMhJEak5I0Tvv/6gkccynmwjkYCSvp8wFYP2Ws9kg5BV//45qu40483Q9W9nG800lHaT+44JQki1vEfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773135784; c=relaxed/simple; bh=UvG+3RrnfJDgPru2ORmG+RIp4PunVyBaqPu4bI4E7v8=; h=Mime-Version:Content-Type:Date:Message-Id:To:From:Subject:Cc: References:In-Reply-To; b=Tc8gcYNFhPl3dxtZ6V8yl+GWhQDRs+cyMz9CkjFAjEmjSm3VOLQEBXoM2HMw04BHQHzpMQTO3h27LIklqo0q5zPTLXTJdHrkTT/VeqUJAvHv8TSZfJ+YyArVDhGo6kolHFoL36D9h4IR2F/7Zc7/+nU3QCHfsk6lI1khwPnhmiw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=GjRKtB2g; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="GjRKtB2g" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id C0889C40404; Tue, 10 Mar 2026 09:43:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0281F60002; Tue, 10 Mar 2026 09:42:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E249A103697F6; Tue, 10 Mar 2026 10:42:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773135773; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=3fFbEQvVsQ3IRalcwIqZe+U20pkjEonkpr/WuxVe4/A=; b=GjRKtB2gBQzWIah5EhyJDMnl3AguxdyZ1leHh/SDVcuHUpEVQp1uZxKqsk/RcxuTDPjyXp 32WzEeZiCqyFft7QNdsXASIT6NTh727vncOzCKJ7MWYyV+YFBPWQ7uu6U0xdPXc4RyOIhI 2++Ps0pMUAllMyTpPdvaRlpxjmvyf29iSKaJUkZFOOT6K6pnW9k5R6gIFDJAPnfUnShGJp foDFsWzZacU4ygs4cY+nTzsoUGZNaeysTxmNft7NPm0LmX/aWSayb0iSUbxV+Fb5uEptEz b643EpRiYq97e3ztAEx/7p7lQD6MME0sp4oVigtLH0CEFnbeSZxfNQZNpldiRg== Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Mar 2026 10:42:48 +0100 Message-Id: To: "Jakub Kicinski" , =?utf-8?q?Th=C3=A9o_Lebrun?= From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH net-next 1/2] net: macb: implement ethtool_ops.get|set_channels() Cc: "Nicolas Ferre" , "Claudiu Beznea" , "Andrew Lunn" , "David S. Miller" , "Eric Dumazet" , "Paolo Abeni" , , , "Vladimir Kondratiev" , "Gregory CLEMENT" , =?utf-8?q?Beno=C3=AEt_Monin?= , "Tawfik Bayouk" , "Thomas Petazzoni" , "Paolo Valerio" , "Alexandre Belloni" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260305-macb-set-channels-v1-0-28e3a96a3dc3@bootlin.com> <20260305-macb-set-channels-v1-1-28e3a96a3dc3@bootlin.com> <20260306190948.44d23f8f@kernel.org> <20260309141542.5a8403eb@kernel.org> In-Reply-To: <20260309141542.5a8403eb@kernel.org> X-Last-TLS-Session-Version: TLSv1.3 On Mon Mar 9, 2026 at 10:15 PM CET, Jakub Kicinski wrote: > On Mon, 09 Mar 2026 18:04:06 +0100 Th=C3=A9o Lebrun wrote: >> On Sat Mar 7, 2026 at 4:09 AM CET, Jakub Kicinski wrote: >> > On Thu, 05 Mar 2026 18:20:14 +0100 Th=C3=A9o Lebrun wrote: =20 >> >> + if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE)) >> >> + return -EOPNOTSUPP; =20 >> > >> > Why not set max to 1 in this case? =20 >>=20 >> With !QUEUE_DISABLE, we only know how to run with all queues enabled. >> It doesn't imply that max_num_queues =3D=3D 1. >>=20 >> MACB_CAPS_QUEUE_DISABLE means that the field QUEUE_DISABLE (BIT0) in the >> per-queue register RBQP disables queue Rx. If we don't have that >> capability we can have multiple queues (if HW supports it) but we must >> always run with all enabled. > > Oh, I see! Perhaps just a comment over the check to inform the reader > that the lack of capabilities means all rx queues must be enabled. ACK, will insert a comment. >> >> + if (running) { >> >> + ret =3D macb_open(bp->dev); >> >> + if (ret) { >> >> + bp->num_queues =3D old_count; >> >> + netif_set_real_num_queues(bp->dev, old_count, old_count); >> >> + macb_open(bp->dev); =20 >> > >> > both macb_open() calls may fail under memory pressure >> > For new functionality we ask drivers to allocate all necessary >> > resources upfront then just swap them in and reconfigure HW =20 >>=20 >> The main reason we want to set queue count is memory savings. If we take >> the Mobileye EyeQ5 SoC, it has a small 32MiB RAM alias usable for DMA. >> If we waste it on networking we have less available for the remaining >> peripherals. Is there some way we could avoid upfront allocations? > > We've been asking everyone to follow the "pre-allocate resources > paradigm" for a few years now. It has huge benefits for system > reliability. If you don't want to complicate code at this stage > you can support configuring queue count only when the device is down. > But the ask will keep coming back, any time you try to do the close+open I'll iterate with a .set_channels() implementation that returns -EBUSY if netif_running(), making sure to leave a comment explaining the tradeoff. Thanks Jakub, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com