Article View: linux.kernel.netdev
Article #19999[PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend
From: Nicolai Buchwitz
Date: Fri, 20 Nov 2026 22:42
Date: Fri, 20 Nov 2026 22:42
68 lines
10982 bytes
10982 bytes
A close or WoL suspend cancels the pending profile work and can leave
DIM in DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive
coalescing then stays stuck after the next open or resume, and the
profile index no longer matches the hardware. The poll also calls
net_dim() after napi_complete_done(), so it can queue new work after
napi_disable() has returned.
Run net_dim() before completing NAPI and flush the work instead of
cancelling it, so the pending profile gets applied. Also reset the DIM
state on ring init and start from the default profile, which is what
bcmgenet_init_rx_coalesce() programs.
Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4d2be2a21ed1..f702916e7bfa 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2502,15 +2502,16 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget)
work_done = bcmgenet_desc_rx(ring, budget);
- if (work_done < budget && napi_complete_done(napi, work_done))
- bcmgenet_rx_ring_int_enable(ring);
-
+ /* net_dim() can queue work, so run it while NAPI is still owned */
if (ring->dim.use_dim) {
dim_update_sample(ring->dim.event_ctr, ring->dim.packets,
ring->dim.bytes, &dim_sample);
net_dim(&ring->dim.dim, &dim_sample);
}
+ if (work_done < budget && napi_complete_done(napi, work_done))
+ bcmgenet_rx_ring_int_enable(ring);
+
return work_done;
}
@@ -2702,8 +2703,11 @@ static void bcmgenet_init_dim(struct bcmgenet_rx_ring *ring,
{
struct bcmgenet_net_dim *dim = &ring->dim;
+ memset(&dim->dim, 0, sizeof(dim->dim));
INIT_WORK(&dim->dim.work, cb);
dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ /* Match the profile bcmgenet_init_rx_coalesce() programs */
+ dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
dim->event_ctr = 0;
dim->packets = 0;
dim->bytes = 0;
@@ -3014,7 +3018,8 @@ static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)
for (i = 0; i <= priv->hw_params->rx_queues; ++i) {
ring = &priv->rx_rings[i];
napi_disable(&ring->napi);
- cancel_work_sync(&ring->dim.dim.work);
+ /* Cancelling would leave DIM stuck in DIM_APPLY_NEW_PROFILE */
+ flush_work(&ring->dim.dim.work);
}
}
--
2.53.0
Technical Details
Message-ID:
<20261120-nb-genet-dim-stats-net-v2-1-1a7cece7dd1a@tipi-net.de>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368186-linux-kernel-netdev=dewy.ruReferences:
<20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368186-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend Date: Fri, 20 Nov 2026 23:42:35 +0100 Organization: Usenet Network Message-ID: <20261120-nb-genet-dim-stats-net-v2-1-1a7cece7dd1a@tipi-net.de> References: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3283593"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:st+3PMfE4GtH3BonHOvwMXml3n8= sha256:YwOc7RADI6RJxUaHnyL3dKsMDwUXz25HUOxUtiWyAkc= sha1:pDNIDutZ0LBk0+DzXlP2WKRmRxI= sha256:03Wp5niz/bJSidNZMwKzHysqMLr12QqivH756Iciq2Q= 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 DA01D115AB0; Sat, 21 Nov 2026 01:43:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[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, URIBL_BLOCKED=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 t7HvRXQ6_oHB; Sat, 21 Nov 2026 01:43:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-368186-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 3015B115AB1; Sat, 21 Nov 2026 01:43:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 5D8496177B6; Fri, 20 Nov 2026 22:43:30 +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=1795214600; b=aMOJSvvKVUug7goAXCHdsPnVQz5xYIgt4k1jeDhOlqP0P45+u1sEGHFQ3FliHsDXw8NG jaSJE10Ep+qKRapithgMwoGTfUrBi+MEzzda70hrleI+n95fzOa6PCo5b342cTSVKHpfA ceQNCmGgrT2XrFQy3TDnINF3qq4svoPoNulrjr2d1REFm1NZ5MdOV6AJfc3PzCs0eCGP9 FkY049Os9LAIcqxb9e1DiSazIdT0qOTk7gG+wYaD2t6MZDjGawsUY0Dy4Cqe4h6eZG0Q8 RPQ0fdgl2LWLELwmD4ESuw8yuyUyjz9lPtygLCA5ODJSX2NlpfHEij6LOUlcrP5kxuQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795214600; h=X-Original-To:Received:DMARC-Filter: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:X-Last-TLS-Session-Version; bh=hn2bqEzOmfG5sa68D2kHFMqd1goW51V+KX1PGAnUV1E=; b=OjF0oxJ2k1dOCAlvgOMqga5q8BsoV2n3UsGYZbJLsYs5Ehq9QUtlbFQrHGJMOZn5CfX8 tTr6LmASrOPA3OCegjS5/Aa0rGYsQCP3jVz3knhnLGofVxBIscCI4pI7wbE8wnqReCLnV LxGfrbbuxAQ/1TlsXkMCRBr15qoklIewB9EHknaHO+9kMhHu1G/g6OlNmqD+85Y3SGJ0S jIa8YjULhkdZ6el32j7KnO2sEmAnEjGFKCm9LPVfLzLrgesIfuWe6+ZYzwKRbaYDiCujl Ws5p0L1eqD7jWMeorEj7quH+22sSH2fY47JuoSNu3JhdzNb2xlYGWLQSaHVMSn7bclQ== 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="BV7XLIo/"; 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 1E11E60A2620; Fri, 20 Nov 2026 22:43:20 +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=BV7XLIo/ 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=1795214594; b=uOgyhTc2AGVhH8cjF33gAEGCmCRDg+ojUlvrEqH3nUPqJAbQ0s1bMpN3WYAPefxuO1WM XhXSGnyia4ouccWIMDLn2nSkyHemiODRXRNiVflLow6H66GxW9W1W4TEEDpTENdQqhokX m4pNCdUjrmVuyTjONEJAdnrq6O+A2pAB5ajZnQH+hjN/m2E2Q9qotRo+UAX+vxAlBReW4 clcpT7QZcXO6EcxGw0NtdMHKtn1DMyGR8na/HNmFQ5UfPpUwt7LzprxvGzXtjK6tE1ihx W87Ru4EodGO1S1LIvibUy/KdOCdO5Fu3PBeAi/LOQjlcvmU8nj3iTxnR2xE2x0dpmqA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795214594; h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=hn2bqEzOmfG5sa68D2kHFMqd1goW51V+KX1PGAnUV1E=; b=qiUJGfkwGXBt+XGFpZtWE9AYJf1WfKsbct6m3rAVzW29xfPILSJv3pB8mIFbddbpEITp Y2BOm9uSbeWDOuPAYR6vkJycDyZ0rE7CipU2+qp6AaviGqF+muupIZ6Ls4PnH0mVGfsj8 LZTnhSMQQS7A2chzDNO61s4YTtICkziJZ/feJ2yKyETYTDeLAp0SdV6jKEZgc/sLqN9k/ DbM8XSapFn6PE//GBZik79Ez5b4nu2yiIO/8HYBTRTCJBI8GrPGO8U6qi2mIM4nI2RxGp GVhryY26mPQDTaMbEFJeQgzlYysvucxUprWR5PvJP9ZPepQy2rCzZaQ4izJ37kTNnmA== 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="BV7XLIo/"; 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)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6058606A332; Fri, 20 Nov 2026 22:43:09 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B6058606A332 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 8950DA4C30; Fri, 20 Nov 2026 23:43:07 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1795214588; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=hn2bqEzOmfG5sa68D2kHFMqd1goW51V+KX1PGAnUV1E=; b=BV7XLIo//mjitl8UBTPpHyTtGPsJPHdQClNs075QDPIvK+iKqoh8yRQ3BozNwKiILQ2oxn ya1QjAweURilpqLje8fKAW7luXn1M0aBwyFB03B1GXCj1gSnrcxRz9FqJUPAxuG5pztyTi e3T5fx5cCQauYGoM8uqqAge8K6X8pY0u3HBjbuIGWjJ2VmianxufFGHDv+MzasYwAFLGOR 5Nsx3eovEnlGwAZ86ofA7ADDGj56B6jC8FaReOlRIbSjwAEez6yx6e62v9CjItiyZcQJIH vcZdgOtQRzgDELgHhz0xaKhCo6l9SY6dlAW5U+QseOv9PoFEJlhVbRraFw5/kg== 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: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> X-Cc: Justin Chen <justin.chen@broadcom.com>, Petri Gynther <pgynther@google.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz <nb@tipi-net.de> X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3