From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C8E641D4C8; Sat, 28 Feb 2026 17:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300746; cv=none; b=GrE53bQbbV+b9SoWueTh7q75DbiWnw+Ng/WHXPwFm9/eff/c4JnkbpY+Ln8ckMUaiVPBS/tenymYRc/58avslQGWNe3cL9s0WCaAeXNAKvfuBacNmuELvzqMVKi0R1L6f2MLDDgkGgfRa4WrkMSPEWRyR6W+J32XTby3e5pMgfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300746; c=relaxed/simple; bh=EtLEKl541sDBEHiRI8iutlpHkytahuMT2YOz0dIiePQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kBtrQsvDySRnyupIgY5lkEHeYggQJ619AX/M26L2uLbHlND2bv6qJKj0fkb81i4/UBzJfDUvftcq6Wosa4/7Xcme3aUAi/N7kx1VyMBCa/uq0vOPHH03p9vyuR9xcyFgjZFfWwpyqcZ7NY+zk7y8nABsqR20y5VV+PQivyc3wog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lHZP1cFG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lHZP1cFG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E696CC19423; Sat, 28 Feb 2026 17:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300746; bh=EtLEKl541sDBEHiRI8iutlpHkytahuMT2YOz0dIiePQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHZP1cFGjiA2auQfLPGjZRAk/NmOkBkXWxC7okkHyWbJ3o/E29BcUK3LmVMt/ow6Q TWoKqSMwSVRN3jKgrPrSEhjr/O/dKVYmMeSJgj6duXTIaV19/28ZnhIYLqJuV6xhX+ sf45sLwROhZWCjtnOwXHHcb1UxBvZmcsZ5irk7gwWlgwo1rZjOMMoQOMhpd+jvveJ5 IGmNNkijXJQ5nJAlYdr6zmW+nSgLEG8+G4WMEv0JB4w4tXr+mXwE9vMjUmfTv1usA0 pPpd6bzpglydT9rZqkNx00KGgcsaEM3noPxKXZEoOeRyzdoY8orxRAUjyL6ohwuf8D iFifVOtrLR+3A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kevin Hao , Paolo Abeni , Sasha Levin Subject: [PATCH 6.19 782/844] net: macb: Fix tx/rx malfunction after phy link down and up Date: Sat, 28 Feb 2026 12:31:35 -0500 Message-ID: <20260228173244.1509663-783-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Kevin Hao [ Upstream commit bf9cf80cab81e39701861a42877a28295ade266f ] In commit 99537d5c476c ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()"), the mog_init_rings() callback was moved from macb_mac_link_up() to macb_open() to resolve a deadlock issue. However, this change introduced a tx/rx malfunction following phy link down and up events. The issue arises from a mismatch between the software queue->tx_head, queue->tx_tail, queue->rx_prepared_head, and queue->rx_tail values and the hardware's internal tx/rx queue pointers. According to the Zynq UltraScale TRM [1], when tx/rx is disabled, the internal tx queue pointer resets to the value in the tx queue base address register, while the internal rx queue pointer remains unchanged. The following is quoted from the Zynq UltraScale TRM: When transmit is disabled, with bit [3] of the network control register set low, the transmit-buffer queue pointer resets to point to the address indicated by the transmit-buffer queue base address register. Disabling receive does not have the same effect on the receive-buffer queue pointer. Additionally, there is no need to reset the RBQP and TBQP registers in a phy event callback. Therefore, move macb_init_buffers() to macb_open(). In a phy link up event, the only required action is to reset the tx software head and tail pointers to align with the hardware's behavior. [1] https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm Fixes: 99537d5c476c ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()") Signed-off-by: Kevin Hao Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260208-macb-init-ring-v1-1-939a32c14635@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 6511ecd5856bd..4ebb40adfab37 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -705,14 +705,12 @@ static void macb_mac_link_up(struct phylink_config *config, if (rx_pause) ctrl |= MACB_BIT(PAE); - /* Initialize rings & buffers as clearing MACB_BIT(TE) in link down - * cleared the pipeline and control registers. - */ - macb_init_buffers(bp); - - for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) + for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { + queue->tx_head = 0; + queue->tx_tail = 0; queue_writel(queue, IER, bp->rx_intr_mask | MACB_TX_INT_FLAGS | MACB_BIT(HRESP)); + } } macb_or_gem_writel(bp, NCFGR, ctrl); @@ -2954,6 +2952,7 @@ static int macb_open(struct net_device *dev) } bp->macbgem_ops.mog_init_rings(bp); + macb_init_buffers(bp); for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { napi_enable(&queue->napi_rx); -- 2.51.0