From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386428; b=R4rNaAJ/xOicvX4I4M6yEhLD1NS0+RLw4yMrBPvdkQUJjV2iA6uc18BokywQrPyxbRgi EdeamdQuNt98EquB5JUzU5roi5kO55ZG+jGk70+LjITLY0Vog5h0nkyB50HDtVCVAWofK UYFNoPkRQsoOmZExnPLUvptsHBtGH6hzIBOzU9su1PtdT/dR4oCK7XhhoLlT285+D0rRc cYdYsM8cMnEj1puPt9tnqS4/S8uIwAl/aHSizw9TxPj4EtHhZXY5VM/FTZOaX4IUXtGkI pMmY3mZzcUj+xtFAZxBi95bAVDKXucMuegq3YPgPtvY6I31pqOj8rg/VQz4z2OudXPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386428; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=I0jIqg/foVa7INa1+t5jZoVqOrh90VWc7uVB+kb/1TQ=; b=C5ZC7RGARW3EXaJcSsxbA9yGg+aJnMdpmmO6qK8wvE/UwlGGjU8w6jluqbdY8BktuTZL T+Umkg/e2ZxAvLOa4Tf/d9RPoJZo7uBlYX9rumPCwyj1BaCS9rQO0H9x+9Es+1NPjf2dC q9X0LIJM+H41mfJRGDUvddm1GVQfanZR6zEP6yfQgeh4zUv3YGAVmbpWo5JIbwbn3yDC3 2Dx1QV6BmjogHWUYFrgoecmnKJ+Pu+352WL4CNx874aQRjrGEIv7b55cwWhWxIQ67v2jt keBSo5+ulmUihKEnMlnwbGQarGpwAT5lgJYcvBtw91daX2HBB3UiV7f40vLY4rcjkjQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=IHRo8KPV; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 D5F4F606A32C; Fri, 4 Dec 2026 12:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=IHRo8KPV Received: by smtp.kernel.org (Postfix) with ESMTPSA id 590321F000C2; Fri, 4 Dec 2026 12:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386428; bh=I0jIqg/foVa7INa1+t5jZoVqOrh90VWc7uVB+kb/1TQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IHRo8KPVQ7qQtj+Xtfs+ulr1w+/i3t7q05vNo5Z/ueq9OZj+jPtXtPNF3tMsgc0lh 6VyaUXrB0E9DSJp29CX6lS6bPpSejmSkURc0apj8Y070gk+T7rzai8Q5D6A4cHdx9w nPp4Zo3HqBr7IRLC6g32ivLkWtd/QBUKGEIe14Kc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nicolai Buchwitz , Florian Fainelli , Willem de Bruijn , Sasha Levin Subject: [PATCH 6.6 0958/1167] net: bcmgenet: keep DIM from getting stuck after close or suspend Date: Fri, 4 Dec 2026 19:06:25 +0900 Message-ID: <20261204100727.141751223@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolai Buchwitz [ Upstream commit aa5a537ec43c13e4d2850468b0d88f97cce45dd3 ] 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 Signed-off-by: Willem de Bruijn Signed-off-by: Sasha Levin --- 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 c613a1f775bb3..b08a934303cf3 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2436,15 +2436,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; } @@ -2638,8 +2639,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; @@ -2915,7 +2919,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