From nobody Tue Nov 24 16:50:28 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B6058606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=BV7XLIo/ 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) 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== From: Nicolai Buchwitz Date: Fri, 20 Nov 2026 23:42:35 +0100 Subject: [PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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> In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> To: Doug Berger , Florian Fainelli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Justin Chen , Petri Gynther , Broadcom internal kernel review list , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 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 Reviewed-by: Florian Fainelli --- 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/e= thernet/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 *nap= i, int budget) =20 work_done =3D bcmgenet_desc_rx(ring, budget); =20 - 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); } =20 + if (work_done < budget && napi_complete_done(napi, work_done)) + bcmgenet_rx_ring_int_enable(ring); + return work_done; } =20 @@ -2702,8 +2703,11 @@ static void bcmgenet_init_dim(struct bcmgenet_rx_rin= g *ring, { struct bcmgenet_net_dim *dim =3D &ring->dim; =20 + memset(&dim->dim, 0, sizeof(dim->dim)); INIT_WORK(&dim->dim.work, cb); dim->dim.mode =3D DIM_CQ_PERIOD_MODE_START_FROM_EQE; + /* Match the profile bcmgenet_init_rx_coalesce() programs */ + dim->dim.profile_ix =3D NET_DIM_DEF_PROFILE_EQE; dim->event_ctr =3D 0; dim->packets =3D 0; dim->bytes =3D 0; @@ -3014,7 +3018,8 @@ static void bcmgenet_disable_rx_napi(struct bcmgenet_= priv *priv) for (i =3D 0; i <=3D priv->hw_params->rx_queues; ++i) { ring =3D &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); } } =20 --=20 2.53.0 From nobody Tue Nov 24 16:50:28 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795214600; b=0FU9PHhBZNOhHKuu87TMA9tbVxczuCONoYmNqI0JjHFKmPmETw1JzGmnue26bzy7dnbY T5c+IjNzW1+stL3uVdtwRVPZFnigp6N/vGmBaDLliLVufRlkYZDDljz4zA5SqYvmYpYnb uAmIUYm9t698pFFAWdkS6GbshbGl/P2LVKvAaAadWR3L7w8CzeY/f4Utza4WKAPUrKCRv Zx5LVrbyE0/mekegbwBHt7NfwY2YI+aottlKIwH3Q5cWHda2prWpQNtElAbmRWFfZ/G07 m6112BzZslUkbYLXXARx48RYHB+Y2Y/gFP3PlbSw/+tF1I8CCKPE6d4K7+mu+rF/dmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795214600; 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=k7///D2GpwDVsxdaecpWEeDbjNHzOzf2WS/HKDmWM6o=; b=f1mekIJaSnScFun59Ot+XfmE7trP2JuHzPqBWwc9yj66wKXNmWy6miSsMASfvsSuVPa2 /vc370Ra4cOj91MqlHIbyRRfYHjh8NT+jRFYUmqRB/acnMaBRYFm1TAAFIAXRdbJIWKTp hfNwI+2S1Sy1+suVkaaNNyiNx9EKAPZSYQgMDRMQL4vI3MLH7BjyA3tfvcdGEfZ4dR3l1 jD8w4gWTFEIaBDIMv8o8frNqmdM8RKPT/j5Zt8B/Y/KLiZ4mepG+ra7nzxE60tE2ijslY 9vqIM384bLq24PbxEGrtkpKvKJ94ohhsyEitGCjsmPRHXiw+wYVHuoiS7m5nT+q39Wg== 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=ojnz9cUk; arc=none smtp.remote-ip=194.13.80.246 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 E2612606A690; Fri, 20 Nov 2026 22:43:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E2612606A690 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de 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=ojnz9cUk Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4B1FBA4C35; Fri, 20 Nov 2026 23:43:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1795214589; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=k7///D2GpwDVsxdaecpWEeDbjNHzOzf2WS/HKDmWM6o=; b=ojnz9cUk+nVbpninVIQT3Xy5i7W/KapsCZujeFo2hXAE9wKptf2Mo+mlv4RA8S4IuLEjws cZj7dtAZmmAUZpM/t8LQyfRSboAF4nsbl1OYCP5ctxEhZnyNKwfc5q6DgcAhlJ8CkP40OB tN5cJ02Ytq0pQ4JUiHgO9ZdbvQyKGTmplkGYgnjB3xDUqfLvxu8dbl+aE5xi8qvQNZFxgH qI9qfBuLE8LZo1rg53BK+zLmGjDtDYwNAXV0yPLw3L/zZarAXdcMNsnoQIdcIbhK4igxup dO4tdf0KGOxu2i/9GmAUpZbqefUTwyqzC7mKEMQ4qlY9T6apMqdUvSSlXvqLHA== From: Nicolai Buchwitz Date: Fri, 20 Nov 2026 23:42:36 +0100 Subject: [PATCH net v2 2/5] net: bcmgenet: accumulate the DIM packet and byte counters X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261120-nb-genet-dim-stats-net-v2-2-1a7cece7dd1a@tipi-net.de> References: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> To: Doug Berger , Florian Fainelli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Justin Chen , Petri Gynther , Broadcom internal kernel review list , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 net_dim() computes rates from the difference between two samples and needs running totals, but bcmgenet_desc_rx() passes the counts of the last poll. Adaptive coalescing then picks profiles from wrong rates. On a CM4 at a steady 300 Mbit/s UDP, DIM changed profile about 1000 times in 20 s. With the fix it settles, and Rx interrupts drop from about 4500/s to 2240/s. Accumulate the counters instead. Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing= ") Reviewed-by: Florian Fainelli Signed-off-by: Nicolai Buchwitz --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/e= thernet/broadcom/genet/bcmgenet.c index f702916e7bfa..f9f38445568f 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2486,8 +2486,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_= rx_ring *ring, bcmgenet_rdma_ring_writel(priv, ring->index, ring->c_index, RDMA_CONS_IN= DEX); } =20 - ring->dim.bytes =3D bytes_processed; - ring->dim.packets =3D rxpktprocessed; + ring->dim.bytes +=3D bytes_processed; + ring->dim.packets +=3D rxpktprocessed; =20 return rxpktprocessed; } --=20 2.53.0 From nobody Tue Nov 24 16:50:28 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795214597; b=JwZzbriNYP9BhAGhOf4h9OzGpTcRgcBf/DzJ3rF5TGK4vRSSStA/9HHvBgt2Kh2fB6ys Eq4pjs2Vd8x51sOviZVuaHHI8WZvElDMprzg8ummQA2jwZsNl12u8SecxesHPQZJTPzg0 YUZ/4d7BDpzFEJYTChyiMMjmRJoajgPNxTZaURR9w4V/29okya5K4TVKQZkVfwX2tKqK2 /SfedP7+0Jl89hMe5NAvYd13k4gSS7UkEEdELSyGlSAVMHD4y6wCOV2xI7A5C3LbIZ0cT uPzNne2D4jKEqyvUEKEo+e24OsiOteAOQcC0BFsyS9y8YuJHKOradZLNl1ojOs9Cvyw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795214597; 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=/jxiGLmfmKTjgadYTv5ZC0oOROfd7E+9MLG34StbnE0=; b=aVMkT7b0Nv5KAeZzjAzB/6fiAAdZpTrnMzIX1i6xM2mQnwDFlpZH4XpmPchMST+mgEmB IIx2aVpm+7ju0nHe1KOoGF5itws/Ufc1OF5ABH5hRw6DMlQe68HCpbXvbUq3t3NIdEgtP 44OoeVzIvcm/6+S2yeE1Fy5EpYsKZrLBBJtf3qNMyL/JUdo0LhcMH+Z2QgCp+E4EJrxzf MZscWwr0qxlb1iRJx69rzSV7ROXtnyxEM3oxyS27eWxfm5gi1A6k/02MoB579SyxsWgaF EnbuMkVKt8gfUbN9DV9faOShO9WMjwGFNaFXUQBdo+1RB7gFMNiTg0q5e2zEvTjbL9w== 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=yEP1fyUY; arc=none smtp.remote-ip=194.13.80.246 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 D2CBF606A333; Fri, 20 Nov 2026 22:43:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D2CBF606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de 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=yEP1fyUY Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 62FFBA4C38; Fri, 20 Nov 2026 23:43:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1795214590; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=/jxiGLmfmKTjgadYTv5ZC0oOROfd7E+9MLG34StbnE0=; b=yEP1fyUYZdSgqUz/8CCXbaDqAxnrYW/AaLqfWxov43J1aFVgaAH8P/IgHUCtw2pzCCjLn0 xyAnQh3mGE6NOGVYG84N0WFM5SfMRN7nq7n7JcROkxzoxMKkyVNBRDY/nC8FnXu2p0S9FH BkOTyhMVoklScNnyegj418RNA5kweh6FyDOdMOvm0ilJZAMKah596uRiUzJl+M47qUxD8R F/yKtvzygj6zcMy/ZizhDNHoImu7FdKWmvbfmgAa8LpgCKx2dbB5JYwC0ctXCLQjVx1GCw 9SV0Grg6EWw18sqajlunuyFqkjZL7cHpTq/qtsrEv3TpS6yaA32hhWq43MxnQQ== From: Nicolai Buchwitz Date: Fri, 20 Nov 2026 23:42:37 +0100 Subject: [PATCH net v2 3/5] net: bcmgenet: reset the Rx discard count with the ring X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261120-nb-genet-dim-stats-net-v2-3-1a7cece7dd1a@tipi-net.de> References: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> To: Doug Berger , Florian Fainelli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Justin Chen , Petri Gynther , Broadcom internal kernel review list , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Ring init clears the hardware discard counter but not ring->old_discards. Discards after an ifdown and ifup or a resume are then missing from rx_missed. On a CM4, after an ifdown and ifup, 3666 discards showed up as 0 in rx_missed. Reset old_discards together with the ring. Fixes: d26ea6cc48da ("net: bcmgenet: collect Rx discarded packet count") Reviewed-by: Florian Fainelli Signed-off-by: Nicolai Buchwitz --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/e= thernet/broadcom/genet/bcmgenet.c index f9f38445568f..b81408e6293c 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2826,6 +2826,8 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv= *priv, ring->read_ptr =3D start_ptr; ring->cb_ptr =3D start_ptr; ring->end_ptr =3D end_ptr - 1; + /* Zeroing RDMA_PROD_INDEX below also clears the discard counter */ + ring->old_discards =3D 0; =20 ret =3D bcmgenet_rx_ring_create_pool(priv, ring); if (ret) --=20 2.53.0 From nobody Tue Nov 24 16:50:28 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6AA5606A68A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de 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 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) 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== From: Nicolai Buchwitz Date: Fri, 20 Nov 2026 23:42:38 +0100 Subject: [PATCH net v2 4/5] net: systemport: restart DIM from the default profile on start X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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> In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> To: Doug Berger , Florian Fainelli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Justin Chen , Petri Gynther , Broadcom internal kernel review list , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 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 coalesc= ing") Signed-off-by: Nicolai Buchwitz --- 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/ether= net/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 *nap= i, int budget) else rdma_writel(priv, priv->rx_c_index << 16, RDMA_CONS_INDEX); =20 - 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); } =20 + 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; } =20 @@ -1452,8 +1453,11 @@ static void bcm_sysport_init_dim(struct bcm_sysport_= priv *priv, { struct bcm_sysport_net_dim *dim =3D &priv->dim; =20 + memset(&dim->dim, 0, sizeof(dim->dim)); INIT_WORK(&dim->dim.work, cb); dim->dim.mode =3D DIM_CQ_PERIOD_MODE_START_FROM_EQE; + /* Match the profile bcm_sysport_init_rx_coalesce() programs */ + dim->dim.profile_ix =3D NET_DIM_DEF_PROFILE_EQE; dim->event_ctr =3D 0; dim->packets =3D 0; dim->bytes =3D 0; --=20 2.53.0 From nobody Tue Nov 24 16:50:28 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795214596; b=G6dAa5aG16Cz/A7cDgOHUm5RzuMociYkddSErUJ/bHqQOHg3mdEjTRZ2cC1nHSQsBKfW ofzMsP4vvrFMWLvIFJnhYTwkWWMO4FOMNYI95p+866HaBBLDRiNeIgEWyem9jjFL4II2I Yn89BBCsEuejyHvnt0EPhqHmYJscfw1sgUnNn4EXCndYvJ65BaluPNGnKOBAYqh+9TW0R bEkw32KFLNwjuVPRG1WxcmNIZCd6v6uLJ9PG9rJuXx6RFt6BcSeir24ZXqi2RFEbJ7hIv LU9efyh38iIVmtskLpppdvYa7pC8otXtS/F3mTR+lx50kHJoVMiezYsBxsX6HD1rivQ== 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=beVIJzhO9G9mQP4NDpUbqUkjliEs+CDfS51LB2XvRJ0=; b=NPNuFUpQXdO17OrtYesFsgNRHV2H9z3hh1J2CDiXXw9mWKXYyGbliNF7tbyKjZVhFG4r H/9jt1w27SK+txH+/kayipFSuzgzfuPnoXDTrP0VY/rsy7+t3nQYb6efnbs0/tcJUrFSO SH1ij/0fHbpRY0uxbLw6FPUkuRbIBLgdPQxcOu2JSKEGsst1OPC+TGnQMwLA0oa4nqHSS p7dxo+qvgXs2Rxdy+g7+WE9cjQnR9loNss6yLB1H/k/itjTAU+xZfD1sQemGTOLQ2E0MJ fcS1Cfomx0TUv+9e1vRTSdN3nOGRGJVdd1FMc+Zzk4HWcP6rFQ0h7s0tAWhCPeXbmtA== 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=dtENblfA; arc=none smtp.remote-ip=194.13.80.246 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 DFDEF606A6B8; Fri, 20 Nov 2026 22:43:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFDEF606A6B8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de 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=dtENblfA Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 53EF6A4C50; Fri, 20 Nov 2026 23:43:11 +0100 (CET) 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=beVIJzhO9G9mQP4NDpUbqUkjliEs+CDfS51LB2XvRJ0=; b=dtENblfAm+MeYpcHD8/wT+ZABx7V5L7ljJw5Z9MYZ6IydLl/pMDdvdSnRs0vTrqe4jaX67 Ryf5AyPsrMgwl8FhjslgqxW3neH+Gzlh6RH2t3+22tNRXIWa41AEJ7PmnniIRPtS9Fq9za Fe0KfKn2h27i8aMz7BZSwB6rChhiUEvwyI1Cvo7KdCsYfid7ipMv1kjNDKCGR90yP5O8qH CfdiCANZI194sxmRll+yxorE3E4mlbhIMqfKwRJ/gax1QFeb2bGo5y/6zjVAj/DUD8gRHI X2xoHlvWX58PSxnAsXFZ4GMDYlFF6YNeJ5XRPIaUzQkl2RCNIgfnOZpdsQ0PTw== From: Nicolai Buchwitz Date: Fri, 20 Nov 2026 23:42:39 +0100 Subject: [PATCH net v2 5/5] net: systemport: accumulate the DIM packet and byte counters X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261120-nb-genet-dim-stats-net-v2-5-1a7cece7dd1a@tipi-net.de> References: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a@tipi-net.de> To: Doug Berger , Florian Fainelli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Justin Chen , Petri Gynther , Broadcom internal kernel review list , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Buchwitz X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 net_dim() computes rates from the difference between two samples and needs running totals, but bcm_sysport_desc_rx() passes the counts of the last poll. Adaptive coalescing then picks profiles from wrong rates. Accumulate the counters instead. Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalesc= ing") Reviewed-by: Florian Fainelli Signed-off-by: Nicolai Buchwitz --- drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ether= net/broadcom/bcmsysport.c index 29e608e7daaf..0902dd0dd94b 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -844,8 +844,8 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysp= ort_priv *priv, priv->rx_read_ptr =3D 0; } =20 - priv->dim.packets =3D processed; - priv->dim.bytes =3D processed_bytes; + priv->dim.packets +=3D processed; + priv->dim.bytes +=3D processed_bytes; =20 return processed; } --=20 2.53.0