🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19949

Re: [PATCH net 2/4] net: bcmgenet: restart DIM from the default profile on ring init

#19949
From: Nicolai Buchwitz
Date: Fri, 20 Nov 2026 20:16
77 lines
11151 bytes
On 19.11.2026 21:31, netdev-bot+sashiko@kernel.org wrote:
> [...]

> [Severity: High]
> Can the same stuck DIM state still happen through Wake-on-LAN
> suspend/resume?
> 
> The reset only runs from bcmgenet_init_dim(). Its only caller is
> bcmgenet_init_rx_ring(), which is reached through bcmgenet_init_dma().
> 
> The WoL branch of bcmgenet_suspend() goes through the same cancel that
> the commit message describes for close:
> 
> bcmgenet_suspend()
>     if (device_may_wakeup(d) && priv->wolopts) {
>         ...
>         bcmgenet_disable_rx_napi(priv);
>         disable_irq(priv->irq1);
>         ...
>     }
> 
> bcmgenet_disable_rx_napi()
>     napi_disable(&ring->napi);
>     cancel_work_sync(&ring->dim.dim.work);
> 
> Suppose the last net_dim() call set dim->state = DIM_APPLY_NEW_PROFILE
> and scheduled the work just before this point. The work is cancelled,
> and bcmgenet_dim_work() never runs. It is the only place that moves the
> state back to DIM_START_MEASURE.
> 
> On resume, the fast path in bcmgenet_resume() re-enables RX NAPI 
> without
> reinitializing the rings:
> 
> bcmgenet_resume()
>     if (priv->tx_cbs && (reg & CMD_RX_EN)) {
>         /* Successfully exited WoL, just resume data flows */
>         ...
>         bcmgenet_enable_rx_napi(priv);
> 
> That means bcmgenet_init_dim() is not called, so the new memset and
> profile_ix reset never run. After that, every net_dim() call hits:
> 
>     case DIM_APPLY_NEW_PROFILE:
>         break;
> 
> Adaptive RX coalescing stays frozen until the next ifdown/ifup. Also,
> profile_ix already points at the new profile, while the
> DMA_MBUF_DONE_THRESH and DMA_RING0_TIMEOUT registers still hold the old
> values.
> 
> Toggling adaptive coalescing through ethtool doesn't seem to recover
> from this, since bcmgenet_set_ring_rx_coalesce() never touches
> dim.state.
> 
> Would it work better to reset ring->dim.dim.state, and re-sync
> profile_ix, in bcmgenet_disable_rx_napi() right after
> cancel_work_sync()? That would cover both close and WoL suspend.
> 
> The later patches in this series ("net: bcmgenet: reset the Rx discard
> count with the ring" and "net: systemport: accumulate the DIM packet 
> and
> byte counters") don't touch this path, so the gap is still there at the
> end of the series.
> 
>>  	dim->event_ctr = 0;
>>  	dim->packets = 0;
>>  	dim->bytes = 0;

Valid point. I will use flush_work() instead, which is IMHO a better 
fit.
It applies the pending profile, so profile_ix and the hardware stay in
sync, and it covers both close and WoL suspend.

--
pw-bot: cr
Technical Details
Message-ID: <8b3c7fb8c73f1f5b224052752969eda4@tipi-net.de>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368128-linux-kernel-netdev=dewy.ru
References: <20261118-nb-genet-dim-stats-net-v1-2-13b275f1e088@tipi-net.de> <179512026414.3136.5512333445190926749@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368128-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/4] net: bcmgenet: restart DIM from the default
 profile on ring init
Date: Fri, 20 Nov 2026 21:16:57 +0100
Organization: Usenet Network
Message-ID: <8b3c7fb8c73f1f5b224052752969eda4@tipi-net.de>
References: <20261118-nb-genet-dim-stats-net-v1-2-13b275f1e088@tipi-net.de>
 <179512026414.3136.5512333445190926749@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3253972"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:L8cANodrvBlsTViRQawJ1ZAIrPU= sha256:+q04ZIy9NajMvcllixwMbYKA8/I7juDw4r//zNp+dg0=
	sha1:HMkwAcAMBk6drDiuF7S5JvxUEKs= sha256:6eweiiB7yFKBs1hiuQ6wU8pKk8eO0j1a2HatZLdY7m0=
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 8F75B115A6F; Fri, 20 Nov 2026 23:17:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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.249,
	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 fiUyuVWDftRm;
	Fri, 20 Nov 2026 23:17:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368128-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 91D94115A6A; Fri, 20 Nov 2026 23:17:12 +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 B2B581421B2; Fri, 20 Nov 2026 20:17:06 +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=1795205826;
	b=3HOQ/nZaDquDxkpgEW5+5fAZAVK/16ZkxYJDYkT1MUuRYSa/90dt0knj6+puVO8amrbI
	 Nq5dHKrCsa0bzS3j8krQDWramVyHWv2Fj3A3OixzOXAADt5DvlsdnO7fY2WsgsC+txVtr
	 0tfAGl8J2cI2GwjO54o8K3LJ5Z6dCDC+1jWdL/RMSBMj1cYGLwkDlKMiH84gjdV4hnsqX
	 gf8AVrlJ38bqJ8+CmgUisn1dkjFhlhAB0iTp3Y4jUK55kq7+EPXQpVLtqgwOqHkp5IyEB
	 zakapaUu7RMxPklb/cX5JH+Kclwe4RRGj351p6UT9NWFfU2b9dRvbgK+DRaQvzq8csA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795205826;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Date:From:To:Cc:
	 Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type:
	 Content-Transfer-Encoding:X-Last-TLS-Session-Version;
	bh=0e8bBESaPWfHk+nLoYr0qrHXqPuIeAD8bwji0lFZ80g=;
	b=43PQhTg/7UkPeXDGY05hXJZZbmwO50CCSUc4/wb/MoMSHSJ+JIO379VTgLjC6rCMZWVo
	 9Dv/YW3jNVNbNO1sAwO0VDHhWFFLYFXzyD0Vqm9dPGKt9RmI0jZR1WMQLc/h0weBgY5X7
	 y0K7kAasDfom9ykmxNqMbYidlhi9/SArFBN4/eEAJrr9lUKBPNYEKDu1FymB05IWCXe/B
	 tIydyV3tHstzQkrWZ7e3CBHMA9fZvVva5v1Qz97bJ3b4b5dVEjOEsGN8Kpro89GzFAgwt
	 K7em1udUhkiiI8YUkYPmhLY3s856nYZetFsfHjDeuS0xgI1HOHXnJ1tCH6ADZHIqUhA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=LBmXLWl2;
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	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 012DD606A6FD;
	Fri, 20 Nov 2026 20:17:06 +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.a=rsa-sha256 header.s=dkim header.b=LBmXLWl2
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795205825;
	b=lCk1B+0ygv8aUNi0IZ3IxGmhjrk6pZpcGPX/s4e4MsAnNurQkoUdpo3QL9ImNAFNrEuQ
	 8eCgeOFSQDrWyZP9ZkNXxOoEZwF9QlreqYEGZegcToTwKaKinmOEAuLjDbHaJiQpSC/cT
	 VM9Mfq8se7cA/F4BQqJ2GCHvDnvTuZt871UKF1u4mF4HmsGMvEA+4GLcv/wHRA2jeJ0nm
	 WCxmYTYUk22QW9a58g24nikoeXaKIgNq7bOoO3/TH+pOIoTs4OFmvGu+OsEVYY5S1Xt1n
	 8mlZPLe2FLLzn2la4B4ZUtB58g4IdJ1LE3uK851ylUydpUHmY2ywTvXp99j6RA9dm5w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795205825;
	h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc:
	 Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type:
	 Content-Transfer-Encoding:X-Last-TLS-Session-Version;
	bh=0e8bBESaPWfHk+nLoYr0qrHXqPuIeAD8bwji0lFZ80g=;
	b=HT7sIXuZt5BAInFj0bpgTxnxHQRcSqdvzkPOoZ4pmeXmsurDwZ3+P+FQrepNfXxfG6/S
	 KnIzIoFztAlAB7q26SCY9yOl5Q7gIZ/O5JRnjaLUFO6H9eCsyoTpkqnPFarh4AfsBmghD
	 ZrKBFNG4+bALRo1cVfr+U7kpk4++IhH9smPz69vApga7fBrLVlo2uRLVQms/ya+9koaCS
	 zys2bHVpOYi+lG304ZX051ondcOs1cQIoZqYjQuu37tWyOWPFwUyQl1+Zkd6/T+VNzTRN
	 biVAJo2xQMJL46+cVpBXmHovAxjx6A7XexH28b11rrQOs9aNk2AlOBuscgUwnF4UCxQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=LBmXLWl2;
	arc=none smtp.remote-ip=194.13.80.246
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00945606A6D5;
	Fri, 20 Nov 2026 20:17:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 00945606A6D5
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 2C071A1579;
	Fri, 20 Nov 2026 21:16:57 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1795205819; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=0e8bBESaPWfHk+nLoYr0qrHXqPuIeAD8bwji0lFZ80g=;
	b=LBmXLWl2Kbf0qEd5Xq9w2yGHcgSLUIbVZOBKUMt/vqfBf7yPioyyJ6zzvCykICwnHDrtgA
	WHCqrjutXKElukP7fA6bLvy9+Q6zmj8jLz6AjG72r4QC3jj2LL2iIVqebzUvqaO0YjuoBG
	bFf724PtfILGRDu25Ui9LbxS7C2DfojAwTPuSxW/lriTHO1YEiItQXlsc4Lpcqltux2Eka
	Fg3aZSng/CfYn1lUk1nRgb1gwEBCBJX2Z427l1WQrzswZgiF7zEqIMyP784xmmll0QrlsA
	yIqTVb9SKtvWNUe8+jdfMDjCktYNU5dYdcwgKXbytkmo5btCt9esWmxCPwvFow==
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-Cc: opendmb@gmail.com, florian.fainelli@broadcom.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, justin.chen@broadcom.com, pgynther@google.com,
 bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org, f.fainelli@gmail.com
X-In-Reply-To: <179512026414.3136.5512333445190926749@kernel.org>
X-Sender: nb@tipi-net.de
X-Last-TLS-Session-Version: TLSv1.3