🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2958

Re: [PATCH net-next v11 0/9] net: macb: implement context swapping

#2958
From: Nicolai Buchwitz
Date: Tue, 13 Oct 2026 19:04
46 lines
7926 bytes
Hi Théo

On 13.10.2026 15:16, Théo Lebrun wrote:
> MACB has a pretty primitive approach to buffer management. They are all
> stored in `struct macb *bp`. On operations that require buffer realloc
> (set_ringparam & change_mtu at the moment), the only option is to close
> the interface, change our global state and re-open the interface.
> 
> Two issues:
> - It doesn't fly on memory pressured systems; we free our precious
>   buffers and don't manage to reallocate fully, meaning our machine
>   just lost its network access.
> - Anecdotally, it is pretty slow because it implies a full PHY reinit.
> 
> Instead, we shall:
>  - allocate a new context (including buffers) first
>  - if it fails, early return without any impact to the interface
>  - stop interface
>  - update global state (bp, netdev, etc)
>  - pass newly allocated buffer pointers to the hardware
>  - start interface
>  - free old context
> 
> This is what we implement here. Both .set_ringparam() and
> .ndo_change_mtu() are covered by this series. In the future,
> at least .set_channels() [0], XDP [1] and XSK [2] would benefit.

> [...]

Tested on a Raspberry Pi CM5 (RP1 GEM) with lockdep and KASAN enabled:

- ring and MTU changes under bidirectional TCP and a UDP flood
- ring and MTU changes while the interface is down
- ring and MTU changes during autoneg
- injected allocation failures in both paths
- PTP and EEE after a swap

Everything worked, and changing either no longer takes the link down.

For the series:

Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # RPi CM5 with RP1 GEM

Thanks,
Nicolai
Technical Details
Message-ID: <27d764b0c5c72de4aff77160b9efe8ef@tipi-net.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345823-linux-kernel-netdev=dewy.ru
References: <20261013-macb-context-v11-0-b27785167566@bootlin.com>

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-345823-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 0/9] net: macb: implement context swapping
Date: Tue, 13 Oct 2026 21:04:42 +0200
Organization: Usenet Network
Message-ID: <27d764b0c5c72de4aff77160b9efe8ef@tipi-net.de>
References: <20261013-macb-context-v11-0-b27785167566@bootlin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2168874"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bWQuP3fcmtOZhDNmPx9/vfGX+CM= sha256:sE14jOqovvMv6xcD5+tX6rUscWIOaAO6pAHaShkkX9Q=
	sha1:imR5WZzum3j3Blo7VLQr9PRVDKI= sha256:9EoYv2NIncXZ0fSCFIlBqQ/6u4UBUrSdSomjCgEV7/I=
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 79F4010FF5C; Wed, 14 Oct 2026 01:37:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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=tipi-net.de
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 B6uPRQQZiDhv;
	Wed, 14 Oct 2026 01:37:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-345823-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2C48210FF5A; Wed, 14 Oct 2026 01:37:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 260E8124F8C; Tue, 13 Oct 2026 19:05:01 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E13053B5FA;
	Tue, 13 Oct 2026 19:04:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="MzvSWfXS"
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(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 2911C522F1B;
	Tue, 13 Oct 2026 19:04:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791918299; cv=none; b=PRKvzw+BSHjJVdT9RBGvPFbch84uvWFB+zPOWTiEssWDwIJN5MD6VTcmNoGSM8JrRsRxgYWcEeJ61MWhvhTTjv8qa8EhGx5eA0GFsT+D1pZWYve0wBWMskJ6Pmeeqq/DjsfNMUHFpdJApuQ8xF6VAieg25kUH7XhvgWaOEUc0hI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791918299; c=relaxed/simple;
	bh=n+8rA6Pb8ILyzEhI8iY9B+JvaJnY9qKVlWFEEGNL2MM=;
	h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References:
	 Message-ID:Content-Type; b=X8pY5QITGmqTu8kiBaHaFIGMyABEpD3zLi52q6MFqBCA8dpuK3+j0Sfoym/CIgHKOVwKNhYWtsd3CBapuvATFu+5JO21+F+nsyJ3JjxADKLWg48vEEAHPt6EB/83VF7W/7y5tfVc/KEme1WnCYgYNsxCqOOqbM8Oe6q9Ovcopi4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=MzvSWfXS; arc=none smtp.client-ip=194.13.80.246
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8598FA1559;
	Tue, 13 Oct 2026 21:04:42 +0200 (CEST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1791918285; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=saDSlwe4mPw49S3N7DFvQPKAKv/DK7HdzCZPVNqXPAs=;
	b=MzvSWfXSXiyDpO5bt7Xz0/jTLRelKl4sQf0mQL/RKDnan4fqqMHp3C1w7Y4shL+LqvA0Wb
	3jlcN855FcGtPTmEjg/hakjaE06qTpqTgiW/cDhbcdKxvE8PQxy4VW2Fftc85aZkMHp3EO
	hrddi0EZ1RZN8kfypfQTKoqdhhzo802Qkb1PAXt6l3of+h0c9MFxxUrybSYVmOYIGf5jb2
	3zu75XCQ7FkvLSIs6lMYWLO9KhQgKTX1j2rStCgEq72xt6MMmz2Bk2wBhsBq/Zh12p10rV
	O5lyDTYaJY+jdCs2zs/ZAuT161WXLOyfETrbMMclr6u4TolpAZoKVWzZXhvsgA==
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-Cc: Conor Dooley <conor.dooley@microchip.com>, Andrew Lunn
 <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric
 Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni
 <pabeni@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Russell
 King <linux@armlinux.org.uk>, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org, Paolo Valerio <pvalerio@redhat.com>, Vladimir
 Kondratiev <vladimir.kondratiev@mobileye.com>, Gregory CLEMENT
 <gregory.clement@bootlin.com>, Benoît Monin
 <benoit.monin@bootlin.com>, Tawfik Bayouk <tawfik.bayouk@mobileye.com>,
 Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
 stable+noautosel@kernel.org, Sashiko <sashiko-bot@kernel.org>
X-In-Reply-To: <20261013-macb-context-v11-0-b27785167566@bootlin.com>
X-Sender: nb@tipi-net.de
X-Last-TLS-Session-Version: TLSv1.3