🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19997

[PATCH net v2 4/5] net: systemport: restart DIM from the default profile on start

#19997
From: Nicolai Buchwitz
Date: Fri, 20 Nov 2026 22:42
62 lines
10616 bytes
A close or suspend can cancel the pending profile work and leave DIM in
DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive coalescing
then stays stuck after the next open or resume. 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. Reset the DIM state on start and
begin from the default profile, which is what
bcm_sysport_init_rx_coalesce() programs.

Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index bc88a27da16b..29e608e7daaf 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1012,18 +1012,19 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
 	else
 		rdma_writel(priv, priv->rx_c_index << 16, RDMA_CONS_INDEX);
 
-	if (work_done < budget) {
-		napi_complete_done(napi, work_done);
-		/* re-enable RX interrupts */
-		intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
-	}
-
+	/* net_dim() can queue work, so run it while NAPI is still owned */
 	if (priv->dim.use_dim) {
 		dim_update_sample(priv->dim.event_ctr, priv->dim.packets,
 				  priv->dim.bytes, &dim_sample);
 		net_dim(&priv->dim.dim, &dim_sample);
 	}
 
+	if (work_done < budget) {
+		napi_complete_done(napi, work_done);
+		/* re-enable RX interrupts */
+		intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
+	}
+
 	return work_done;
 }
 
@@ -1452,8 +1453,11 @@ static void bcm_sysport_init_dim(struct bcm_sysport_priv *priv,
 {
 	struct bcm_sysport_net_dim *dim = &priv->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 bcm_sysport_init_rx_coalesce() programs */
+	dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
 	dim->event_ctr = 0;
 	dim->packets = 0;
 	dim->bytes = 0;

-- 
2.53.0
Technical Details
Message-ID: <20261120-nb-genet-dim-stats-net-v2-4-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-368187-linux-kernel-netdev=dewy.ru
References: <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-368187-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 4/5] net: systemport: restart DIM from the default
 profile on start
Date: Fri, 20 Nov 2026 23:42:38 +0100
Organization: Usenet Network
Message-ID: <20261120-nb-genet-dim-stats-net-v2-4-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="3283485"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CLtss+4rNVikf1MhcTnQFiQECc0= sha256:p1GKCtW2J2on982Wf964jKTVWnfUJgNQeXxDuYNDrRk=
	sha1:+TH/GZA7IZIcbcbY2u0Do1Phdj8= sha256:V+jqxS1OuhtG3Ncyyd1sBQUknpiYDn/upw+4B2CmO5Q=
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 0444E115AB0; Sat, 21 Nov 2026 01:43: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.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 EqKXIB7SLhCr;
	Sat, 21 Nov 2026 01:43:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368187-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id D8A5E115A8E; Sat, 21 Nov 2026 01:43:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id E422331CA5; Fri, 20 Nov 2026 22:43:21 +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=1795214597;
	b=A8kjIkCdsCQGtBQ36pJGkTaqmmJMk+6oTCc5cTXa1fDJFwaAhtJ+uz9sSzDK4yY3oCVb
	 vZ+zekxFWKImAyvqipbtErj6MzANv4b9gxrIh7ihVpmN+AnBE8Nn7FgFPOWBAGyC6Z+8Z
	 C5SoSKI9P50JM4hB7Tff0S/klJngEI1QzX4S8AgyZNF+83t2d5M9WiNLPcLm/58swSNek
	 sjt3IZh082DyBI2LPpK2J0Ld3lOV3EZY9+tWUMbSwasGQZlbtgZzAoE1oVgudLVb/zd5R
	 NzEvu1debCC7vXgSEzoWKzdGjwdFygbC+Tg2G0FWRXkPa4WFrMUYK+ph2ZibYOb8z3w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795214597;
	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=Y6B1qlUZWjZO+GSdjVFEgrQK8iWfGeM64GnIiZ+w6F4=;
	b=M8nBVrAoUOw6m/Z+j5Pf9FkjdW3Q1HFh4tXIkBQNwlGorG4wEB2uXJUV0osEuEtgn69S
	 rmv0fbEANX1AaLqPcbGkXvXDskG1CoA7G7x1D5cypLoXmEsMjTwy57nfwBs85cAXGJ/oS
	 nSdByO8MSdkpKds2oZ6sexvCC1N/9mxYhHylTCWIXgbJabhBuIdAcyhvs0PdNRJRXLvwD
	 YGAvxiEUf5IJ8vevLcAGKxV58qnNUZQMYtEDQllDohYQSmWwAtlk3hnGZ9j9jmZ6oES1d
	 zHp4BZ0LYYcbU1p8vXLuckRgoYveNotuV0gPQT0jPFsvyyf7w3iTQG7Bh1j7mvZldaQ==
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=UyNVNUuV;
	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 32EBC60A260E;
	Fri, 20 Nov 2026 22:43:17 +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=UyNVNUuV
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=1795214596;
	b=Ht707fTd0roY98eU5O5Po5TjWqCoH+q6yVi8WOLQThEPXVuP7NK2nwDCRLuppuPja16S
	 UfEcM23XHzuKDvQtJnfuStDGhrLl7XPejmwQp/08QvpZ6iw8bx1kkiasL1FHSt9wtq3Jy
	 J9Rxgf4fUBhopT2Vm+BYS+uC7dB4XhkjUmom4GfQlOhrL1yXygSAlufKn+NH3EeFLTYl/
	 bVNqUmSfvyCAshy6FnuBwgz3zA4j5cDjE/Y3+ElnPkAZ2l+Nh0T4HusjRzM1OiS6Acg5L
	 XfYD7UoK8fIqa8opu0eqMZkj1IUG0pYEELIDJd0/Og4YEYSy7CKhWvDXcG+XJsXAZAw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795214596;
	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=Y6B1qlUZWjZO+GSdjVFEgrQK8iWfGeM64GnIiZ+w6F4=;
	b=hlp4FHn+lXJ5HdrfZ4QVk/5DCQi0qKkgaV4tcs2katkafmD560ihcKpINmYZZrMReQbw
	 nxyIRCmV95MXOOQkxdO5jjJ2DMEwT2qYnymTC+2TyPZK95mIrle5Y6VkvzyvvusaqMtT0
	 OeHAzpEQenh5pTd7BgRpn8gaDXJvuiO3Qb9Yj3fb/ueriRBCkysVMlya/veV/+A1KdJYM
	 eOb02P0z1BOnZndQFKPH9ZY5uIrTkgKlb1eOBUkvKUqMFAZwf0UKFHGmNpgyFN9G92RJY
	 zWl0HyfZ9z2Sh4kfCNSUV6SQSX5SPD5l007u19ioqklC2EHcTL/RlXnKKcC7T5uY6ng==
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=UyNVNUuV;
	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 D6AA5606A68A;
	Fri, 20 Nov 2026 22:43:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6AA5606A68A
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 57E41A4C4E;
	Fri, 20 Nov 2026 23:43:10 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1795214591; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=Y6B1qlUZWjZO+GSdjVFEgrQK8iWfGeM64GnIiZ+w6F4=;
	b=UyNVNUuVleHIObwHZ462iMXCiQKfjXOhooFMHMPwnT+xEYWjjxIZfktq2CwoBdh2zesYvo
	owB/db4c4ZOWr3j3kanqJEJGbm6oKyqr9FIYCbVkGhqQsWzE2x7IwmAea+URHNQkpoElRD
	kHxc+GAy23cOkkxQ2i7h1qevuTX3K9C353/lcUIjTSNVHMbCFV3fMtrQdFzlmiKFZFUWLC
	JKoGZ7Kj0rr+m9P3ZNb6o7DbR0Od0IAgTJslVadeMjqKzhs4xXJmb8UbufpQjmBtxUQ8vm
	oxoxZWtRDDtVEaeEx59jhI4xErFOL9jIwSQzQtFmiwUqoo9C85pABGI4o00/Bw==
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