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 8D4D37DA6A; Wed, 5 Feb 2025 14:35:58 +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=1738766158; cv=none; b=KUu+DK7mKGWiIYXuYXoXVwCf1f/NMxMJCg7E3FCVgaYl9BgKsI7MC8NPjES8jHbci7Rq8g0c0yPB2QVhJwnXIZd/UO/r5lhNVsvkH87w/d1uv7XJMt19e+DOtbupJxzkd5UsrNJVzrMHWrIECdL19SIns3FcvKGFRd/A/KagjjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738766158; c=relaxed/simple; bh=uRN2Jb5Ye8/+gbR6GMakYxGCVAf4iPfSqceluUwU38w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H4FzFCkY5SfxnSc/CXPYVAkGIxY2W3PT3gZ0Wm2TRDQFowVddfWllSHFMYnlVdUVZJWLzpS2Gteq6yl/q/duhQ6sUFyAiJRz3Tp4t4dRBnWCre90mGuSQnZ7UOuVUvDczmbY1jOnhRqKHQd4ewBsdxjPcpr29BR4pKPkMahvT6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gGaKZWN4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gGaKZWN4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14DE7C4CED1; Wed, 5 Feb 2025 14:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738766158; bh=uRN2Jb5Ye8/+gbR6GMakYxGCVAf4iPfSqceluUwU38w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGaKZWN4QsZUwBDuvX+w3xmHrmfHt4wL6nwuc/AWT+Ik1VdCPPnnBX1WuesikMYzj oKAt5SJXMBLXaCI5nwBXYwGUouddRVT4bgm3e9E9t1wuBHqI/9JQtRzupaoa5pfs1s D5yjTxaTdwO4h/C0An3aqrNTZkOgHnmKtWl/TMWc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kunihiko Hayashi , Yanteng Si , Paolo Abeni , Sasha Levin Subject: [PATCH 6.6 335/393] net: stmmac: Limit FIFO size by hardware capability Date: Wed, 5 Feb 2025 14:44:14 +0100 Message-ID: <20250205134433.129089871@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250205134420.279368572@linuxfoundation.org> References: <20250205134420.279368572@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kunihiko Hayashi [ Upstream commit 044f2fbaa2725696ecbf1f02ba7ab0a8ccb7e1ae ] Tx/Rx FIFO size is specified by the parameter "{tx,rx}-fifo-depth" from stmmac_platform layer. However, these values are constrained by upper limits determined by the capabilities of each hardware feature. There is a risk that the upper bits will be truncated due to the calculation, so it's appropriate to limit them to the upper limit values and display a warning message. This only works if the hardware capability has the upper limit values. Fixes: e7877f52fd4a ("stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree") Signed-off-by: Kunihiko Hayashi Reviewed-by: Yanteng Si Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 48ad12bca9566..d3d5c01f6dcba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7118,6 +7118,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv) priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues; } + if (priv->dma_cap.rx_fifo_size && + priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) { + dev_warn(priv->device, + "Rx FIFO size (%u) exceeds dma capability\n", + priv->plat->rx_fifo_size); + priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size; + } + if (priv->dma_cap.tx_fifo_size && + priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) { + dev_warn(priv->device, + "Tx FIFO size (%u) exceeds dma capability\n", + priv->plat->tx_fifo_size); + priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size; + } + priv->hw->vlan_fail_q_en = (priv->plat->flags & STMMAC_FLAG_VLAN_FAIL_Q_EN); priv->hw->vlan_fail_q = priv->plat->vlan_fail_q; -- 2.39.5